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

Method get_location

src/_pytest/terminal.py:298–306  ·  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

296 count_towards_summary: ClassVar = True
297
298 def get_location(self, config: Config) -> Optional[str]:
299 """Return the more user-friendly information about the location of a warning, or None."""
300 if self.nodeid:
301 return self.nodeid
302 if self.fslocation:
303 filename, linenum = self.fslocation
304 relpath = bestrelpath(config.invocation_params.dir, absolutepath(filename))
305 return f"{relpath}:{linenum}"
306 return None
307
308
309@final

Callers 1

Calls 2

bestrelpathFunction · 0.90
absolutepathFunction · 0.90

Tested by

no test coverage detected