gh-92886: fixed tests that were breaking while running with basic optimizations enabled (-O, assertions off)#93174
gh-92886: fixed tests that were breaking while running with basic optimizations enabled (-O, assertions off)#93174jackh-ncl wants to merge 14 commits intopython:mainfrom
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.
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.'" | ||
|
|
|
|
||
| @threading_helper.reap_threads | ||
| @cpython_only | ||
| @unittest.skipUnless(__debug__, "Won't work if __debug__ is False") |
There was a problem hiding this comment.
_mesg() @ Lib/imaplib.py:1247 is defined within a if __debug__ block, so I assume this test can be skipped when running with optimizations.
| # 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.
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.
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