File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -297,6 +297,19 @@ def setUp(self):
297
297
self .open = partial (io .open , mode = 'wt' , encoding = 'utf-8' )
298
298
self .dont_write_bytecode = sys .dont_write_bytecode
299
299
sys .dont_write_bytecode = True
300
+
301
+ # Because these tests create Python source files at runtime,
302
+ # it's possible for the importlib.machinery.FileFinder for
303
+ # a directory to have an outdated cache in the following situation:
304
+ # * a module in that directory is imported,
305
+ # * then a new module is created in that directory,
306
+ # * then that new module is imported.
307
+ #
308
+ # invalidate_cache() is used to prevent this.
309
+ #
310
+ # see https://docs.python.org/3/library/importlib.html
311
+ # sections #importlib.machinery.FileFinder and
312
+ # #importlib.invalidate_caches
300
313
invalidate_caches ()
301
314
302
315
def tearDown (self ):
You can’t perform that action at this time.
0 commit comments