Node.location: handle str with _node_location_to_relpath
This commit is contained in:
parent
ef112fd7dd
commit
1350c601dc
|
@ -462,7 +462,9 @@ 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()
|
||||||
assert isinstance(location[0], py.path.local), location[0]
|
fspath = location[0]
|
||||||
fspath = self.session._node_location_to_relpath(location[0])
|
if not isinstance(fspath, py.path.local):
|
||||||
|
fspath = py.path.local(fspath)
|
||||||
|
fspath = 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 (fspath, location[1], location[2])
|
||||||
|
|
|
@ -395,9 +395,12 @@ def test_raises(testdir):
|
||||||
raise BaseException
|
raise BaseException
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
result = testdir.runpytest()
|
result = testdir.runpytest("-vv")
|
||||||
result.stdout.fnmatch_lines(
|
result.stdout.fnmatch_lines(
|
||||||
[
|
[
|
||||||
|
"test_raises.py::test_raises_runtimeerror PASSED*",
|
||||||
|
"test_raises.py::test_raises_baseexception_not_caught FAILED*",
|
||||||
|
"test_raises.py::test_raises_baseexception_caught PASSED*",
|
||||||
"*= FAILURES =*",
|
"*= FAILURES =*",
|
||||||
"*_ test_raises_baseexception_not_caught _*",
|
"*_ test_raises_baseexception_not_caught _*",
|
||||||
"",
|
"",
|
||||||
|
|
Loading…
Reference in New Issue