Skip to content

Commit 4f7617c

Browse files
pythongh-108927: Do not remove tested modules from sys.modules
It breaks import machinery if the test module has submodules used in other tests.
1 parent ad1d6a1 commit 4f7617c

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

Lib/test/libregrtest/runtest.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,10 +434,6 @@ def regrtest_runner(result, test_func, ns) -> None:
434434
def _load_run_test(result: TestResult, ns: Namespace) -> None:
435435
# Load the test function, run the test function.
436436
module_name = abs_module_name(result.test_name, ns.testdir)
437-
438-
# Remove the module from sys.module to reload it if it was already imported
439-
sys.modules.pop(module_name, None)
440-
441437
test_mod = importlib.import_module(module_name)
442438

443439
if hasattr(test_mod, "test_main"):

0 commit comments

Comments
 (0)