diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index 5053d49f463..71a1cd53c2e 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -346,6 +346,7 @@ class ImportTests(unittest.TestCase): pkg_name = "extension" pkg_file = pkg_name + "{}".format("_d.pyd" if debug else ".pyd") with open(pkg_file, "w"): pass + importlib.invalidate_caches() try: with self.assertRaises(ImportError) as err: import extension