-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-106300: Improve assertRaises(Exception)
usages in tests
#106302
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
Conversation
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.
LGTM. But we need to run tests on buildbots to ensure that the same exceptions are raised on all platforms.
There are also few assertRaises(BaseException)
. Could you add these cases too?
Of course, if these cases are not already excluded by your rules. |
For me it would be easier to merge this one first, then I can work on |
Changes in mock look fine to me, so removing myself as a reviewer. Thanks for the work! :-) |
Thanks @sobolevn for the PR, and @brettcannon for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
Thanks! |
Sorry, @sobolevn and @brettcannon, I could not cleanly backport this to |
GH-106534 is a backport of this pull request to the 3.12 branch. |
|
|
|
…ythonGH-106302) (cherry picked from commit 6e6a4cd)
…ests (pythonGH-106302). (cherry picked from commit 6e6a4cd) Co-authored-by: Nikita Sobolev <[email protected]>
…ests (pythonGH-106302). (cherry picked from commit 6e6a4cd) Co-authored-by: Nikita Sobolev <[email protected]>
GH-106545 is a backport of this pull request to the 3.11 branch. |
…H-106302). (GH-106545) (cherry picked from commit 6e6a4cd) Co-authored-by: Nikita Sobolev <[email protected]>
Things I did:
zlib.error
as an exampleCustomError
definitions to be sure that we get what we expect in a custom raising codeassertRaisesRegex
where possibleNote that
test_unittest
will have its own PR due to bugs I found in #106300 (comment)This PR does only change semantics, no bugs.
assertRaises(Regex)?(Exception)
is problematic #106300