summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipe LaĆ­ns <lains@archlinux.org>2022-05-16 23:05:47 (GMT)
committerGitHub <noreply@github.com>2022-05-16 23:05:47 (GMT)
commitc7d699969c81dbadd26fa2af5bc647fa5579eb08 (patch)
tree6a9583b3920675920438e6f7a846f708d73632bf
parent00f22e8cc234aa52ec1f28094a170d7b87d0d08f (diff)
downloadcpython-c7d699969c81dbadd26fa2af5bc647fa5579eb08.zip
cpython-c7d699969c81dbadd26fa2af5bc647fa5579eb08.tar.gz
cpython-c7d699969c81dbadd26fa2af5bc647fa5579eb08.tar.bz2
gh-92265: set meta_path and path_hooks correctly in test_reload_namespace_changed (GH-92275)
Previously, we were blocking the frozen imports and forcing the source version to be used, but we did not fix up sys.meta_path or sys.path_hooks, causing the frozen importers to leak into the source version of the test.
-rw-r--r--Lib/test/test_importlib/test_api.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py
index 1f8f7c0..ddf8094 100644
--- a/Lib/test/test_importlib/test_api.py
+++ b/Lib/test/test_importlib/test_api.py
@@ -301,7 +301,8 @@ class ReloadTests:
name = 'spam'
with os_helper.temp_cwd(None) as cwd:
with test_util.uncache('spam'):
- with import_helper.DirsOnSysPath(cwd):
+ with test_util.import_state(path=[cwd]):
+ self.init._bootstrap_external._install(self.init._bootstrap)
# Start as a namespace package.
self.init.invalidate_caches()
bad_path = os.path.join(cwd, name, '__init.py')