diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py index 961787b6f9058b..baf03ef6cd95ee 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -1192,6 +1192,7 @@ def test_already_imported_module_without_origin_or_spec(self): (dir1 / mod).mkdir() (dir1 / mod / "__init__.py").touch() (dir1 / mod / "foo.py").touch() + pkgutil.get_importer(_dir1).invalidate_caches() module = importlib.import_module(mod) assert module.__spec__ if mod == "no_origin":