Attila Bukor has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/19633 )

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]>
---
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:
  Kudu Jenkins: Verified
  Attila Bukor: Looks good to me, approved

--
To view, visit http://gerrit.cloudera.org:8080/19633
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I41e2d69996ee0ed0f0418ae184d95239f2739efb
Gerrit-Change-Number: 19633
Gerrit-PatchSet: 11
Gerrit-Owner: Marton Greber <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Attila Bukor <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <[email protected]>
Gerrit-Reviewer: Zoltan Chovan <[email protected]>

Reply via email to