-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
gh-92886: fixed tests that were breaking while running with basic optimizations enabled (-O, assertions off) #93174
Conversation
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
@@ -5690,45 +5690,48 @@ def test_joinable_queue(self): | |||
|
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.
Could be worth fixing the rest of the assertions in this file?
code_info_consts = "0: None" | ||
else: | ||
code_info_consts = "0: 'Formatted details of methods, functions, or code.'" | ||
|
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.
@@ -939,6 +939,7 @@ def test_with_statement_logout(self): | |||
|
|||
@threading_helper.reap_threads | |||
@cpython_only | |||
@unittest.skipUnless(__debug__, "Won't work if __debug__ is False") |
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.
_mesg()
@ Lib/imaplib.py:1247
is defined within a if __debug__
block, so I assume this test can be skipped when running with optimizations.
@@ -235,11 +235,12 @@ def pycompilecmd(self, *args, **kwargs): | |||
# assert_python_* helpers don't return proc object. We'll just use | |||
# subprocess.run() instead of spawn_python() and its friends to test | |||
# stdin support of the CLI. | |||
opts = '-m' if __debug__ else '-Om' |
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'm not sure how this actually fixed things, but it seems to have done the trick 🤷♂️
(13, 'line'), | ||
(13, 'return')]) | ||
(10, 'line')] + | ||
([(13, 'line'), (13, 'return')] if __debug__ else [(10, 'return')])) |
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.
The assertions on line 819 affect the line numbers we are testing here when running with optimizations.
An alternative could be for these test functions to do something other than an assert
.
Please limit this PR to tests only (files in the Lib/test directory). It may make sense to break this up in multiple PRs. |
@erlend-aasland I've split it out into several PRs, which hopefully doesn't seem too overkill. I can see there being some level of back and forth for a number of them. |
Thanks. One PR per file was perhaps a little bit too much, but IMO it is better than one PR for everything. IIUC, this PR is now superfluous and can be closed? |
Resolves #92886