MCPcopy
hub / github.com/pytest-dev/pytest / _makepath

Method _makepath

src/_pytest/_code/code.py:1120–1128  ·  view source on GitHub ↗
(self, path: Path | str)

Source from the content-addressed store, hash-verified

1118 return ReprEntry(lines, None, None, None, style)
1119
1120 def _makepath(self, path: Path | str) -> str:
1121 if not self.abspath and isinstance(path, Path):
1122 try:
1123 np = bestrelpath(Path.cwd(), path)
1124 except OSError:
1125 return str(path)
1126 if len(np) < len(str(path)):
1127 return np
1128 return str(path)
1129
1130 def repr_traceback(self, excinfo: ExceptionInfo[BaseException]) -> ReprTraceback:
1131 traceback = filter_excinfo_traceback(self.tbfilter, excinfo)

Calls 1

bestrelpathFunction · 0.90

Tested by 1