Rewrite Item.location to be clearer with regard to types
This commit is contained in:
parent
0b6258ab5b
commit
9dcdea5de7
|
@ -462,9 +462,10 @@ class Item(Node):
|
||||||
@cached_property
|
@cached_property
|
||||||
def location(self) -> Tuple[str, Optional[int], str]:
|
def location(self) -> Tuple[str, Optional[int], str]:
|
||||||
location = self.reportinfo()
|
location = self.reportinfo()
|
||||||
fspath = location[0]
|
if isinstance(location[0], py.path.local):
|
||||||
if not isinstance(fspath, py.path.local):
|
fspath = location[0]
|
||||||
fspath = py.path.local(fspath)
|
else:
|
||||||
fspath = self.session._node_location_to_relpath(fspath)
|
fspath = py.path.local(location[0])
|
||||||
|
relfspath = self.session._node_location_to_relpath(fspath)
|
||||||
assert type(location[2]) is str
|
assert type(location[2]) is str
|
||||||
return (fspath, location[1], location[2])
|
return (relfspath, location[1], location[2])
|
||||||
|
|
Loading…
Reference in New Issue