Yingchun Lai has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/19981 )
Change subject: [Python] Refactor tests to use assertRaisesRegex ...................................................................... [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]> (cherry picked from commit 08bd36a8745d20c5aa688f5c33a05615857d40e0) Reviewed-on: http://gerrit.cloudera.org:8080/19981 Reviewed-by: Marton Greber <[email protected]> Reviewed-by: Yingchun Lai <[email protected]> --- M python/kudu/compat.py M python/kudu/tests/test_client.py M python/kudu/tests/test_scanner.py M python/kudu/tests/test_scantoken.py M python/kudu/tests/test_schema.py M python/kudu/tests/util.py 6 files changed, 108 insertions(+), 51 deletions(-) Approvals: Marton Greber: Looks good to me, but someone else must approve Kudu Jenkins: Verified Yingchun Lai: Looks good to me, approved -- To view, visit http://gerrit.cloudera.org:8080/19981 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: branch-1.17.x Gerrit-MessageType: merged Gerrit-Change-Id: I41e2d69996ee0ed0f0418ae184d95239f2739efb Gerrit-Change-Number: 19981 Gerrit-PatchSet: 2 Gerrit-Owner: Alexey Serbin <[email protected]> Gerrit-Reviewer: Attila Bukor <[email protected]> Gerrit-Reviewer: Kudu Jenkins (120) Gerrit-Reviewer: Marton Greber <[email protected]> Gerrit-Reviewer: Yingchun Lai <[email protected]>
