gh-152391: Improve test_interpreters.test_stress test#152396
Merged
Conversation
| from test.support import threading_helper | ||
| # Raise SkipTest if subinterpreters not supported. | ||
| _interpreters = import_helper.import_module('_interpreters') | ||
| from concurrent import interpreters |
Member
There was a problem hiding this comment.
This doesn’t work, this imports _interpreters, the above was a skip.
stan@stanlaptop:~/dev/cpython{issue-152391}$ rm Modules/_interpreters.cpython-316d-x86_64-linux-gnu.so
stan@stanlaptop:~/dev/cpython{issue-152391}$ ./python -c "import _interpreters"
Traceback (most recent call last):
File "<string>", line 1, in <module>
import _interpreters
ModuleNotFoundError: Standard library module '_interpreters' was not found
stan@stanlaptop:~/dev/cpython{issue-152391}$ ./python -m test test_interpreters
Using random seed: 134531407
0:00:00 load avg: 0.87 mem: 50.5 MiB Run 1 test sequentially in a single process
0:00:00 load avg: 0.87 mem: 50.5 MiB [1/1] test_interpreters
Failed to import test module: test.test_interpreters.test_channels
Traceback (most recent call last):
File "/home/stan/dev/cpython/Lib/unittest/loader.py", line 433, in _find_test_path
module = self._get_module_from_name(name)
File "/home/stan/dev/cpython/Lib/unittest/loader.py", line 374, in _get_module_from_name
__import__(name)
~~~~~~~~~~^^^^^^
File "/home/stan/dev/cpython/Lib/test/test_interpreters/test_channels.py", line 11, in <module>
from concurrent import interpreters
File "/home/stan/dev/cpython/Lib/concurrent/interpreters/__init__.py", line 5, in <module>
import _interpreters
ModuleNotFoundError: Standard library module '_interpreters' was not found
Failed to import test module: test.test_interpreters.test_queues
Traceback (most recent call last):
File "/home/stan/dev/cpython/Lib/unittest/loader.py", line 433, in _find_test_path
module = self._get_module_from_name(name)
File "/home/stan/dev/cpython/Lib/unittest/loader.py", line 374, in _get_module_from_name
__import__(name)
~~~~~~~~~~^^^^^^
File "/home/stan/dev/cpython/Lib/test/test_interpreters/test_queues.py", line 10, in <module>
from concurrent import interpreters
File "/home/stan/dev/cpython/Lib/concurrent/interpreters/__init__.py", line 5, in <module>
import _interpreters
ModuleNotFoundError: Standard library module '_interpreters' was not found
Failed to import test module: test.test_interpreters.test_stress
Traceback (most recent call last):
File "/home/stan/dev/cpython/Lib/unittest/loader.py", line 433, in _find_test_path
module = self._get_module_from_name(name)
File "/home/stan/dev/cpython/Lib/unittest/loader.py", line 374, in _get_module_from_name
__import__(name)
~~~~~~~~~~^^^^^^
File "/home/stan/dev/cpython/Lib/test/test_interpreters/test_stress.py", line 7, in <module>
from concurrent import interpreters
File "/home/stan/dev/cpython/Lib/concurrent/interpreters/__init__.py", line 5, in <module>
import _interpreters
ModuleNotFoundError: Standard library module '_interpreters' was not found
test test_interpreters crashed -- Traceback (most recent call last):
File "/home/stan/dev/cpython/Lib/test/libregrtest/single.py", line 210, in _runtest_env_changed_exc
_load_run_test(result, runtests)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/home/stan/dev/cpython/Lib/test/libregrtest/single.py", line 165, in _load_run_test
regrtest_runner(result, test_func, runtests)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stan/dev/cpython/Lib/test/libregrtest/single.py", line 118, in regrtest_runner
test_result = test_func()
File "/home/stan/dev/cpython/Lib/test/libregrtest/single.py", line 162, in test_func
return run_unittest(test_mod, runtests)
File "/home/stan/dev/cpython/Lib/test/libregrtest/single.py", line 38, in run_unittest
raise Exception("errors while loading tests")
Exception: errors while loading tests
0:00:00 load avg: 0.87 mem: 52.5 MiB [1/1/1] test_interpreters failed (uncaught exception)
== Tests result: FAILURE ==
1 test failed:
test_interpreters
Total duration: 506 ms
Total tests: run=0
Total test files: run=1/1 failed=1
Result: FAILURE
Member
Author
There was a problem hiding this comment.
yeap :(
had to revert this.
Closed
StanFromIreland
approved these changes
Jun 27, 2026
|
Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
GH-152427 is a backport of this pull request to the 3.15 branch. |
|
Sorry, @sobolevn, I could not cleanly backport this to |
|
GH-152428 is a backport of this pull request to the 3.14 branch. |
|
GH-152430 is a backport of this pull request to the 3.13 branch. |
sobolevn
added a commit
that referenced
this pull request
Jun 27, 2026
sobolevn
added a commit
that referenced
this pull request
Jun 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_interpreters.test_stressdefinitions #152391