Call importlib.invalidate_caches() after creating module files in test_threaded_import.

This commit is contained in:
Antoine Pitrou 2012-12-18 23:28:24 +01:00
commit dcac718236
1 changed files with 3 additions and 0 deletions

View File

@ -7,6 +7,7 @@
import os
import imp
import importlib
import sys
import time
import shutil
@ -190,6 +191,7 @@ class ThreadedImportTests(unittest.TestCase):
f.write(contents.encode('utf-8'))
self.addCleanup(forget, name)
importlib.invalidate_caches()
results = []
def import_ab():
import A
@ -220,6 +222,7 @@ class ThreadedImportTests(unittest.TestCase):
f.write(code.encode('utf-8'))
self.addCleanup(unlink, filename)
self.addCleanup(forget, TESTFN)
importlib.invalidate_caches()
__import__(TESTFN)