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

Method _locationline

src/_pytest/terminal.py:1034–1055  ·  view source on GitHub ↗
(
        self, nodeid: str, fspath: str, lineno: int | None, domain: str
    )

Source from the content-addressed store, hash-verified

1032 )
1033
1034 def _locationline(
1035 self, nodeid: str, fspath: str, lineno: int | None, domain: str
1036 ) -> str:
1037 def mkrel(nodeid: str) -> str:
1038 line = self.config.cwd_relative_nodeid(nodeid)
1039 if domain and line.endswith(domain):
1040 line = line[: -len(domain)]
1041 values = domain.split("[")
1042 values[0] = values[0].replace(".", "::") # don't replace '.' in params
1043 line += "[".join(values)
1044 return line
1045
1046 # fspath comes from testid which has a "/"-normalized path.
1047 if fspath:
1048 res = mkrel(nodeid)
1049 if self.verbosity >= 2 and (
1050 nodeid.split("::", maxsplit=1)[0] != nodes.norm_sep(fspath)
1051 ):
1052 res += " <- " + bestrelpath(self.startpath, Path(fspath))
1053 else:
1054 res = "[location]"
1055 return res + " "
1056
1057 def _getfailureheadline(self, rep):
1058 head_line = rep.head_line

Callers 2

Calls 1

bestrelpathFunction · 0.90

Tested by

no test coverage detected