[MRG] Use pytest for asserting exceptions in all test methods.#464
[MRG] Use pytest for asserting exceptions in all test methods.#464lesteve merged 4 commits intojoblib:masterfrom
Conversation
b89586e to
478b66b
Compare
joblib/testing.py
Outdated
| # Python 2.7 | ||
| assert_raises_regex = _dummy.assertRaisesRegexp | ||
|
|
||
| assert_raises = pytest.raises |
There was a problem hiding this comment.
I would use raises = pytest.raises it is not really asserting anything any more.
There was a problem hiding this comment.
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...
joblib/test/test_memory.py
Outdated
|
|
||
| result.clear() | ||
| assert_raises(KeyError, result.get) | ||
| raises(KeyError, result.get) |
There was a problem hiding this comment.
@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.
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.raisesproduces a less noisy error log upon failure. This PR replaces all theassert_raisesandassert_raises_regexcalls withpytest_assert_raises. Finally theunittest'sassert_raisesis removed fromjoblib.testingandpytest_assert_raiseshas been renamed asraises.assert_raisesandassert_raises_regexcalls have been modified as:assert_raises(old) andassert_raises_regexwere the last of helpers used fromunittestmodule. By this PR, the testing infrastructure no longer directly depends onunittest.