-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
bpo-33746: Fix test_unittest when run in verbose mode #7799
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
Only make sure that the result is in unittest.signals._results, don't check the full content of unittest.signals._results. support._run_suite() uses TextTestRunner in verbose mode, but TextTestRunner.run() calls registerResult(result) which made the test fail with "odd object in result set". Call also removeResult() to restore unittest.signals._results to avoid side effect of the test.
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!
Added a tiny suggestion.
Lib/unittest/test/test_break.py
Outdated
self.fail("result not found") | ||
|
||
try: | ||
self.assertIn(result, unittest.signals._results) |
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 add self.assertNotIn(result, unittest.signals._results)
just before unittest.registerResult(result)
.
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
Test also assertNotIn() before registerResult().
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
…thonGH-7799) Only make sure that the result is in unittest.signals._results, don't check the full content of unittest.signals._results. support._run_suite() uses TextTestRunner in verbose mode, but TextTestRunner.run() calls registerResult(result) which made the test fail with "odd object in result set". Call also removeResult() to restore unittest.signals._results to avoid test side effect. (cherry picked from commit fd8fbce) Co-authored-by: Victor Stinner <[email protected]>
GH-7820 is a backport of this pull request to the 3.7 branch. |
…thonGH-7799) Only make sure that the result is in unittest.signals._results, don't check the full content of unittest.signals._results. support._run_suite() uses TextTestRunner in verbose mode, but TextTestRunner.run() calls registerResult(result) which made the test fail with "odd object in result set". Call also removeResult() to restore unittest.signals._results to avoid test side effect. (cherry picked from commit fd8fbce) Co-authored-by: Victor Stinner <[email protected]>
GH-7821 is a backport of this pull request to the 3.6 branch. |
…-7799) Only make sure that the result is in unittest.signals._results, don't check the full content of unittest.signals._results. support._run_suite() uses TextTestRunner in verbose mode, but TextTestRunner.run() calls registerResult(result) which made the test fail with "odd object in result set". Call also removeResult() to restore unittest.signals._results to avoid test side effect. (cherry picked from commit fd8fbce) Co-authored-by: Victor Stinner <[email protected]>
…-7799) Only make sure that the result is in unittest.signals._results, don't check the full content of unittest.signals._results. support._run_suite() uses TextTestRunner in verbose mode, but TextTestRunner.run() calls registerResult(result) which made the test fail with "odd object in result set". Call also removeResult() to restore unittest.signals._results to avoid test side effect. (cherry picked from commit fd8fbce) Co-authored-by: Victor Stinner <[email protected]>
Only make sure that the result is in unittest.signals._results, don't
check the full content of unittest.signals._results.
support._run_suite() uses TextTestRunner in verbose mode, but
TextTestRunner.run() calls registerResult(result) which made the test
fail with "odd object in result set".
Call also removeResult() to restore unittest.signals._results to
avoid side effect of the test.
https://bugs.python.org/issue33746