Title: test_interpreters fails when running tests sequentially · Issue #115490 · python/cpython · GitHub
Open Graph Title: test_interpreters fails when running tests sequentially · Issue #115490 · python/cpython
X Title: test_interpreters fails when running tests sequentially · Issue #115490 · python/cpython
Description: Bug report Bug description: test_interpreters fails when running tests sequentially (which we do as part of the release process). The easiest reproducer seems to be python -m test test_interpreters test_interpreters.test_channels: % bin/...
Open Graph Description: Bug report Bug description: test_interpreters fails when running tests sequentially (which we do as part of the release process). The easiest reproducer seems to be python -m test test_interpreters...
X Description: Bug report Bug description: test_interpreters fails when running tests sequentially (which we do as part of the release process). The easiest reproducer seems to be python -m test test_interpreters...
Opengraph URL: https://github.com/python/cpython/issues/115490
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"test_interpreters fails when running tests sequentially","articleBody":"# Bug report\n\n### Bug description:\n\ntest_interpreters fails when running tests sequentially (which we do as part of the release process). The easiest reproducer seems to be `python -m test test_interpreters test_interpreters.test_channels`:\n\n```\n% bin/python -m test test_interpreters test_interpreters.test_channels\n0:00:00 load avg: 0.86 [1/2] test_interpreters\n0:00:02 load avg: 0.87 [2/2] test_interpreters.test_channels\ntest test_interpreters.test_channels crashed -- Traceback (most recent call last):\n File \"/tmp/testinstall/lib/python3.13/test/libregrtest/single.py\", line 178, in _runtest_env_changed_exc\n _load_run_test(result, runtests)\n ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^\n File \"/tmp/testinstall/lib/python3.13/test/libregrtest/single.py\", line 125, in _load_run_test\n test_mod = importlib.import_module(module_name)\n ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^\n File \"/tmp/testinstall/lib/python3.13/importlib/__init__.py\", line 88, in import_module\n return _bootstrap._gcd_import(name[level:], package, level)\n ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1387, in _gcd_import\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1360, in _find_and_load\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1331, in _find_and_load_unlocked\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 935, in _load_unlocked\n File \"\u003cfrozen importlib._bootstrap_external\u003e\", line 1014, in exec_module\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 488, in _call_with_frames_removed\n File \"/tmp/testinstall/lib/python3.13/test/test_interpreters/test_channels.py\", line 10, in \u003cmodule\u003e\n from test.support.interpreters import channels\n File \"/tmp/testinstall/lib/python3.13/test/support/interpreters/channels.py\", line 171, in \u003cmodule\u003e\n _channels._register_end_types(SendChannel, RecvChannel)\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^\nTypeError: already registered\n```\n\nThe cause is libregrtest's behaviour of [unloading newly imported modules from `sys.modules`](https://github.com/python/cpython/blob/main/Lib/test/libregrtest/main.py#L338) after each test run. Either test.support.interpreters.channels should support being imported multiple times (perhaps by not doing any setup at import time, but via deliberate calls?), or libregrtest should be taught to skip unloading test.support.interpreters modules.\n\n@ericsnowcurrently, since this seems to be your area, any opinion making test.support.interpreters do the right thing here?\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-115493\n* gh-115515\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/Yhg1s","@type":"Person","name":"Yhg1s"},"datePublished":"2024-02-14T20:47:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/115490/cpython/issues/115490"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c49a85ac-2ab2-2064-865a-13dc2bd418d3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8310:28D644:19B1A27:2225198:6A52C2BA |
| html-safe-nonce | d7837a3980edff672c0a9b00f5d5b71d195fcff8098dee307529627f1b51956b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzEwOjI4RDY0NDoxOUIxQTI3OjIyMjUxOTg6NkE1MkMyQkEiLCJ2aXNpdG9yX2lkIjoiODkwNjc0MjQyMzg5NzY4NjcxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b7d7eacdb8f961cd3f480c0400712bf460cde44c79ddc057949efa02d2ccf5fa |
| hovercard-subject-tag | issue:2135179144 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/115490/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f65956a143e364f75eb3173195efd461d98472b3eef80b18c4c0c2071e13b648/python/cpython/issues/115490 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f65956a143e364f75eb3173195efd461d98472b3eef80b18c4c0c2071e13b648/python/cpython/issues/115490 |
| og:image:alt | Bug report Bug description: test_interpreters fails when running tests sequentially (which we do as part of the release process). The easiest reproducer seems to be python -m test test_interpreters... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Yhg1s |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width