Remove redundant Python 2.7 code
This commit is contained in:
parent
a642650e17
commit
c9e5042d6d
|
@ -1,3 +1,4 @@
|
||||||
|
import importlib
|
||||||
import io
|
import io
|
||||||
import operator
|
import operator
|
||||||
import os
|
import os
|
||||||
|
@ -20,13 +21,6 @@ from _pytest._code.code import FormattedExcinfo
|
||||||
from _pytest._io import TerminalWriter
|
from _pytest._io import TerminalWriter
|
||||||
from _pytest.pytester import LineMatcher
|
from _pytest.pytester import LineMatcher
|
||||||
|
|
||||||
try:
|
|
||||||
import importlib
|
|
||||||
except ImportError:
|
|
||||||
invalidate_import_caches = None
|
|
||||||
else:
|
|
||||||
invalidate_import_caches = getattr(importlib, "invalidate_caches", None)
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from _pytest._code.code import _TracebackStyle
|
from _pytest._code.code import _TracebackStyle
|
||||||
|
|
||||||
|
@ -445,8 +439,7 @@ class TestFormattedExcinfo:
|
||||||
modpath = tmpdir.join("mod.py")
|
modpath = tmpdir.join("mod.py")
|
||||||
tmpdir.ensure("__init__.py")
|
tmpdir.ensure("__init__.py")
|
||||||
modpath.write(source)
|
modpath.write(source)
|
||||||
if invalidate_import_caches is not None:
|
importlib.invalidate_caches()
|
||||||
invalidate_import_caches()
|
|
||||||
return modpath.pyimport()
|
return modpath.pyimport()
|
||||||
|
|
||||||
return importasmod
|
return importasmod
|
||||||
|
|
Loading…
Reference in New Issue