8000 gh-115490: Work around test.support.interpreters.channels not handlin… · python/cpython@b0e5c35 · GitHub
[go: up one dir, main page]

Skip to content

Commit b0e5c35

Browse files
authored
gh-115490: Work around test.support.interpreters.channels not handling unloading (#115515)
Work around test.support.interpreters.channels not handling unloading, which regrtest does when running tests sequentially, by explicitly skipping the unloading of test.support.interpreters and its submodules. This can be rolled back once test.support.interpreters.channels supports unloading, if we are keeping sequential runs in the same process around.
1 parent a0149fa commit b0e5c35

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Lib/test/libregrtest/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,15 @@ def run_tests_sequentially(self, runtests) -> None:
335335

336336
result = self.run_test(test_name, runtests, tracer)
337337

338-
# Unload the newly imported test modules (best effort finalization)
338+
# Unload the newly imported test modules (best effort
339+
# finalization). To work around gh-115490, don't unload
340+
# test.support.interpreters and its submodules even if they
341+
# weren't loaded before.
342+
keep = "test.support.interpreters"
339343
new_modules = [module for module in sys.modules
340344
if module not in save_modules and
341-
module.startswith(("test.", "test_"))]
345+
module.startswith(("test.", "test_"))
346+
and not module.startswith(keep)]
342347
for module in new_modules:
343348
sys.modules.pop(module, None)
344349
# Remove the attribute of the parent module.

0 commit comments

Comments
 (0)
0