parent
f288afde1d
commit
9d17cebe64
1
AUTHORS
1
AUTHORS
|
@ -139,6 +139,7 @@ Grigorii Eremeev (budulianin)
|
||||||
Guido Wesdorp
|
Guido Wesdorp
|
||||||
Guoqiang Zhang
|
Guoqiang Zhang
|
||||||
Harald Armin Massa
|
Harald Armin Massa
|
||||||
|
Harshna
|
||||||
Henk-Jaap Wagenaar
|
Henk-Jaap Wagenaar
|
||||||
Holger Kohr
|
Holger Kohr
|
||||||
Hugo van Kemenade
|
Hugo van Kemenade
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Fix `pytest -vv` crashing with an internal exception `AttributeError: 'str' object has no attribute 'relative_to'` in some cases.
|
|
@ -685,6 +685,8 @@ def bestrelpath(directory: Path, dest: Path) -> str:
|
||||||
|
|
||||||
If no such path can be determined, returns dest.
|
If no such path can be determined, returns dest.
|
||||||
"""
|
"""
|
||||||
|
assert isinstance(directory, Path)
|
||||||
|
assert isinstance(dest, Path)
|
||||||
if dest == directory:
|
if dest == directory:
|
||||||
return os.curdir
|
return os.curdir
|
||||||
# Find the longest common directory.
|
# Find the longest common directory.
|
||||||
|
|
|
@ -862,8 +862,10 @@ class TerminalReporter:
|
||||||
yellow=True,
|
yellow=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _locationline(self, nodeid, fspath, lineno, domain):
|
def _locationline(
|
||||||
def mkrel(nodeid):
|
self, nodeid: str, fspath: str, lineno: Optional[int], domain: str
|
||||||
|
) -> str:
|
||||||
|
def mkrel(nodeid: str) -> str:
|
||||||
line = self.config.cwd_relative_nodeid(nodeid)
|
line = self.config.cwd_relative_nodeid(nodeid)
|
||||||
if domain and line.endswith(domain):
|
if domain and line.endswith(domain):
|
||||||
line = line[: -len(domain)]
|
line = line[: -len(domain)]
|
||||||
|
@ -873,13 +875,12 @@ class TerminalReporter:
|
||||||
return line
|
return line
|
||||||
|
|
||||||
# collect_fspath comes from testid which has a "/"-normalized path.
|
# collect_fspath comes from testid which has a "/"-normalized path.
|
||||||
|
|
||||||
if fspath:
|
if fspath:
|
||||||
res = mkrel(nodeid)
|
res = mkrel(nodeid)
|
||||||
if self.verbosity >= 2 and nodeid.split("::")[0] != fspath.replace(
|
if self.verbosity >= 2 and nodeid.split("::")[0] != fspath.replace(
|
||||||
"\\", nodes.SEP
|
"\\", nodes.SEP
|
||||||
):
|
):
|
||||||
res += " <- " + bestrelpath(self.startpath, fspath)
|
res += " <- " + bestrelpath(self.startpath, Path(fspath))
|
||||||
else:
|
else:
|
||||||
res = "[location]"
|
res = "[location]"
|
||||||
return res + " "
|
return res + " "
|
||||||
|
|
Loading…
Reference in New Issue