_pytest._py.path: importlib mode always available
This commit is contained in:
parent
eebbfc65c9
commit
63c4d45c59
|
@ -1,8 +1,11 @@
|
|||
"""
|
||||
local path implementation.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import atexit
|
||||
import fnmatch
|
||||
import importlib.util
|
||||
import io
|
||||
import os
|
||||
import posixpath
|
||||
|
@ -440,11 +443,6 @@ def map_as_list(func, iter):
|
|||
return list(map(func, iter))
|
||||
|
||||
|
||||
ALLOW_IMPORTLIB_MODE = sys.version_info > (3, 5)
|
||||
if ALLOW_IMPORTLIB_MODE:
|
||||
import importlib
|
||||
|
||||
|
||||
class Stat:
|
||||
def __getattr__(self, name):
|
||||
return getattr(self._osstatresult, "st_" + name)
|
||||
|
@ -1110,8 +1108,6 @@ class LocalPath(FSBase):
|
|||
if ensuresyspath == "importlib":
|
||||
if modname is None:
|
||||
modname = self.purebasename
|
||||
if not ALLOW_IMPORTLIB_MODE:
|
||||
raise ImportError("Can't use importlib due to old version of Python")
|
||||
spec = importlib.util.spec_from_file_location(modname, str(self))
|
||||
if spec is None:
|
||||
raise ImportError(
|
||||
|
|
Loading…
Reference in New Issue