Skip to content

gh-152391: Improve test_interpreters.test_stress test#152396

Merged
sobolevn merged 2 commits into
python:mainfrom
sobolevn:issue-152391
Jun 27, 2026
Merged

gh-152391: Improve test_interpreters.test_stress test#152396
sobolevn merged 2 commits into
python:mainfrom
sobolevn:issue-152391

Conversation

@sobolevn

@sobolevn sobolevn commented Jun 27, 2026

Copy link
Copy Markdown
Member

@sobolevn sobolevn requested a review from StanFromIreland June 27, 2026 11:49
@sobolevn sobolevn added skip news needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jun 27, 2026
@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Jun 27, 2026
from test.support import threading_helper
# Raise SkipTest if subinterpreters not supported.
_interpreters = import_helper.import_module('_interpreters')
from concurrent import interpreters

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeap :(
had to revert this.

Comment thread Lib/test/test_interpreters/test_stress.py Outdated
@chaithanya6577 chaithanya6577 mentioned this pull request Jun 27, 2026
@sobolevn sobolevn requested a review from StanFromIreland June 27, 2026 14:49
@sobolevn sobolevn merged commit 219f7a9 into python:main Jun 27, 2026
52 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jun 27, 2026

Copy link
Copy Markdown

GH-152427 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 27, 2026
@miss-islington-app

Copy link
Copy Markdown

Sorry, @sobolevn, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 219f7a9453a2a89266f6e65d75df1606b4816043 3.13

@bedevere-app

bedevere-app Bot commented Jun 27, 2026

Copy link
Copy Markdown

GH-152428 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 27, 2026
@bedevere-app

bedevere-app Bot commented Jun 27, 2026

Copy link
Copy Markdown

GH-152430 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jun 27, 2026
sobolevn added a commit that referenced this pull request Jun 27, 2026
…2396) (#152427)

gh-152391: Improve `test_interpreters.test_stress` test (GH-152396)
(cherry picked from commit 219f7a9)

Co-authored-by: sobolevn <mail@sobolevn.me>
sobolevn added a commit that referenced this pull request Jun 27, 2026
…2396) (#152428)

gh-152391: Improve `test_interpreters.test_stress` test (GH-152396)
(cherry picked from commit 219f7a9)

Co-authored-by: sobolevn <mail@sobolevn.me>
sobolevn added a commit that referenced this pull request Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants