-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MRG] Use pytest for asserting exceptions in all test methods. #464
[MRG] Use pytest for asserting exceptions in all test methods. #464
Conversation
b89586e
to
478b66b
Compare
# Python 2.7 | ||
assert_raises_regex = _dummy.assertRaisesRegexp | ||
|
||
assert_raises = pytest.raises |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use raises = pytest.raises
it is not really asserting anything any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in next commit. Although I am skeptical about the changing of old assert_raises
calls. Either we should avoid this renaming or replce old assert_raises
calls with with
blocks as well...
@@ -451,7 +451,7 @@ def test_call_and_shelve(tmpdir): | |||
assert result.get() == 5 | |||
|
|||
result.clear() | |||
assert_raises(KeyError, result.get) | |||
raises(KeyError, result.get) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lesteve for example, statements like this will seem weird. I did not use a with
statement where regex is not checked. What do you think about this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using blocks (i.e. with with
statements) is nicer indeed.
fde404c
to
23e20ec
Compare
23e20ec
to
a5d3e60
Compare
LGTM, I just pushed a minor cosmetic change. I'll wait for the CIs to be green and I'll merge this one. |
All righty, all green, merging, thanks a lot! |
Great ! 😄 Time for |
Fourth Phase PR on #411 (Succeeding PR #463 )
pytest.raises
produces a less noisy error log upon failure. This PR replaces all theassert_raises
andassert_raises_regex
calls withpytest_assert_raises
. Finally theunittest
'sassert_raises
is removed fromjoblib.testing
andpytest_assert_raises
has been renamed asraises
.assert_raises
andassert_raises_regex
calls have been modified as:assert_raises
(old) andassert_raises_regex
were the last of helpers used fromunittest
module. By this PR, the testing infrastructure no longer directly depends onunittest
.