Merge pull request #11774 from bluetech/fspath-cleanups
Small `fspath` cleanups
This commit is contained in:
commit
1d7349d18c
|
@ -1674,11 +1674,6 @@ class FixtureManager:
|
||||||
self._holderobjseen.add(holderobj)
|
self._holderobjseen.add(holderobj)
|
||||||
autousenames = []
|
autousenames = []
|
||||||
for name in dir(holderobj):
|
for name in dir(holderobj):
|
||||||
# ugly workaround for one of the fspath deprecated property of node
|
|
||||||
# todo: safely generalize
|
|
||||||
if isinstance(holderobj, nodes.Node) and name == "fspath":
|
|
||||||
continue
|
|
||||||
|
|
||||||
# The attribute can be an arbitrary descriptor, so the attribute
|
# The attribute can be an arbitrary descriptor, so the attribute
|
||||||
# access below can raise. safe_getatt() ignores such exceptions.
|
# access below can raise. safe_getatt() ignores such exceptions.
|
||||||
obj = safe_getattr(holderobj, name, None)
|
obj = safe_getattr(holderobj, name, None)
|
||||||
|
|
|
@ -488,7 +488,7 @@ def get_fslocation_from_item(node: "Node") -> Tuple[Union[str, Path], Optional[i
|
||||||
|
|
||||||
* "location": a pair (path, lineno)
|
* "location": a pair (path, lineno)
|
||||||
* "obj": a Python object that the node wraps.
|
* "obj": a Python object that the node wraps.
|
||||||
* "fspath": just a path
|
* "path": just a path
|
||||||
|
|
||||||
:rtype: A tuple of (str|Path, int) with filename and 0-based line number.
|
:rtype: A tuple of (str|Path, int) with filename and 0-based line number.
|
||||||
"""
|
"""
|
||||||
|
@ -499,7 +499,7 @@ def get_fslocation_from_item(node: "Node") -> Tuple[Union[str, Path], Optional[i
|
||||||
obj = getattr(node, "obj", None)
|
obj = getattr(node, "obj", None)
|
||||||
if obj is not None:
|
if obj is not None:
|
||||||
return getfslineno(obj)
|
return getfslineno(obj)
|
||||||
return getattr(node, "fspath", "unknown location"), -1
|
return getattr(node, "path", "unknown location"), -1
|
||||||
|
|
||||||
|
|
||||||
class Collector(Node, abc.ABC):
|
class Collector(Node, abc.ABC):
|
||||||
|
|
Loading…
Reference in New Issue