From: Ɓukasz Langa Date: Mon, 5 Jan 2026 17:00:48 +0000 (+0100) Subject: gh-69605: In test_pyrepl.test_already_imported*, invalidate FS import caches (#143436) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f9a8d075ee52b8f56aca14102c8bf9fd6f3c512;p=thirdparty%2FPython%2Fcpython.git gh-69605: In test_pyrepl.test_already_imported*, invalidate FS import caches (#143436) This makes the test robust against file systems with low timestamp resolution, which otherwise would fail to re-import in the tight loop of the test. --- diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py index 961787b6f905..baf03ef6cd95 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -1192,6 +1192,7 @@ class TestPyReplModuleCompleter(TestCase): (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":