mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-108927: Fix removing testing modules from sys.modules (GH-108952)
It breaks import machinery if the test module has submodules used in other tests.
This commit is contained in:
parent
c718ab92a5
commit
e08b70fab1
8 changed files with 67 additions and 9 deletions
|
@ -122,10 +122,6 @@ def _load_run_test(result: TestResult, runtests: RunTests) -> None:
|
|||
# Load the test module and run the tests.
|
||||
test_name = result.test_name
|
||||
module_name = abs_module_name(test_name, runtests.test_dir)
|
||||
|
||||
# Remove the module from sys.module to reload it if it was already imported
|
||||
sys.modules.pop(module_name, None)
|
||||
|
||||
test_mod = importlib.import_module(module_name)
|
||||
|
||||
if hasattr(test_mod, "test_main"):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue