From afbdc13c1b6141f1690a19bebdbf3a131cbfcf84 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sat, 14 Apr 2012 15:06:17 -0400 Subject: [PATCH] Fix an import race condition. --- Lib/test/test_coding.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_coding.py b/Lib/test/test_coding.py index f9db0b40f00..dfd5431dee8 100644 --- a/Lib/test/test_coding.py +++ b/Lib/test/test_coding.py @@ -1,7 +1,6 @@ - import test.support, unittest from test.support import TESTFN, unlink, unload -import os, sys +import importlib, os, sys class CodingTest(unittest.TestCase): def test_bad_coding(self): @@ -40,6 +39,7 @@ class CodingTest(unittest.TestCase): f.write("'A very long string %s'\n" % ("X" * 1000)) f.close() + importlib.invalidate_caches() __import__(TESTFN) finally: f.close()