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