MCPcopy Create free account
hub / github.com/pytest-dev/pytest / _makepath

Method _makepath

src/_pytest/_code/code.py:838–846  ·  view source on GitHub ↗
(self, path: Union[Path, str])

Source from the content-addressed store, hash-verified

836 return ReprEntry(lines, None, None, None, style)
837
838 def _makepath(self, path: Union[Path, str]) -> str:
839 if not self.abspath and isinstance(path, Path):
840 try:
841 np = bestrelpath(Path.cwd(), path)
842 except OSError:
843 return str(path)
844 if len(np) < len(str(path)):
845 return np
846 return str(path)
847
848 def repr_traceback(self, excinfo: ExceptionInfo[BaseException]) -> "ReprTraceback":
849 traceback = excinfo.traceback

Calls 1

bestrelpathFunction · 0.90

Tested by 1