File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed
Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change 1+ import importlib
12import io
23import operator
34import os
2021from _pytest ._io import TerminalWriter
2122from _pytest .pytester import LineMatcher
2223
23- try :
24- import importlib
25- except ImportError :
26- invalidate_import_caches = None
27- else :
28- invalidate_import_caches = getattr (importlib , "invalidate_caches" , None )
29-
3024if TYPE_CHECKING :
3125 from _pytest ._code .code import _TracebackStyle
3226
@@ -445,8 +439,7 @@ def importasmod(source):
445439 modpath = tmpdir .join ("mod.py" )
446440 tmpdir .ensure ("__init__.py" )
447441 modpath .write (source )
448- if invalidate_import_caches is not None :
449- invalidate_import_caches ()
442+ importlib .invalidate_caches ()
450443 return modpath .pyimport ()
451444
452445 return importasmod
You can’t perform that action at this time.
0 commit comments