https://github.com/python/cpython/commit/4f9a8d075ee52b8f56aca14102c8bf9fd6f3c512
commit: 4f9a8d075ee52b8f56aca14102c8bf9fd6f3c512
branch: main
author: Ɓukasz Langa <[email protected]>
committer: ambv <[email protected]>
date: 2026-01-05T18:00:48+01:00
summary:

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.

files:
M Lib/test/test_pyrepl/test_pyrepl.py

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":

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to