10000 gh-92265: set meta_path and path_hooks correctly in test_reload_names… · python/cpython@c7d6999 · GitHub
[go: up one dir, main page]

Skip to content

Commit c7d6999

Browse files
authored
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.
1 parent 00f22e8 commit c7d6999

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/test/test_importlib/test_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,8 @@ def test_reload_namespace_changed(self):
301301
name = 'spam'
302302
with os_helper.temp_cwd(None) as cwd:
303303
with test_util.uncache('spam'):
304-
with import_helper.DirsOnSysPath(cwd):
304+
with test_util.import_state(path=[cwd]):
305+
self.init._bootstrap_external._install(self.init._bootstrap)
305306
# Start as a namespace package.
306307
self.init.invalidate_caches()
307308
bad_path = os.path.join(cwd, name, '__init.py')

0 commit comments

Comments
 (0)
0