From 4f9a8d075ee52b8f56aca14102c8bf9fd6f3c512 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Langa?= Date: Mon, 5 Jan 2026 18:00:48 +0100 Subject: [PATCH] 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. --- Lib/test/test_pyrepl/test_pyrepl.py | 1 + 1 file changed, 1 insertion(+) 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": -- 2.47.3