Issue #14599: Fix an import caching race condition.
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
index 5053d49..71a1cd5 100644
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -346,6 +346,7 @@
         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