forked from apache/kudu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Python] Refactor tests to use assertRaisesRegex
The Python unittest.TestCase class offers the assertRaises() and assertRaisesRegex() functions to test that an exception is raised when callable is called [1]. Currently assertRaises(exception) is used in the Python client tests, to assert the type of a given error. This patch refactors usages of assertRaises() to assertRaisesRegex(exception, regex) in order to assert the error message as well. In Python3.2 assertRaisesRegexp has been renamed to assertRaisesRegex (without the trailing 'p') [2]. To be able to use assertRaisesRegex throughout the Python codebase, a compatibility class called CompatUnitTest is added. [1] https://docs.python.org/3/library/unittest.html#unittest.TestCase [2] https://docs.python.org/3.9/library/unittest.html #unittest.TestCase.assertRaisesRegex Change-Id: I41e2d69996ee0ed0f0418ae184d95239f2739efb Reviewed-on: http://gerrit.cloudera.org:8080/19633 Tested-by: Kudu Jenkins Reviewed-by: Attila Bukor <[email protected]>
- Loading branch information
1 parent
8af7b88
commit 08bd36a
Showing
6 changed files
with
108 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.