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

Method get_location

src/_pytest/terminal.py:367–375  ·  view source on GitHub ↗

Return the more user-friendly information about the location of a warning, or None.

(self, config: Config)

Source from the content-addressed store, hash-verified

365 count_towards_summary: ClassVar = True
366
367 def get_location(self, config: Config) -> str | None:
368 """Return the more user-friendly information about the location of a warning, or None."""
369 if self.nodeid:
370 return self.nodeid
371 if self.fslocation:
372 filename, linenum = self.fslocation
373 relpath = bestrelpath(config.invocation_params.dir, absolutepath(filename))
374 return f"{relpath}:{linenum}"
375 return None
376
377
378@final

Callers 1

Calls 2

bestrelpathFunction · 0.90
absolutepathFunction · 0.90

Tested by

no test coverage detected