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

Method reportinfo

src/_pytest/python.py:331–346  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

329 return ".".join(parts)
330
331 def reportinfo(self) -> Tuple[Union["os.PathLike[str]", str], Optional[int], str]:
332 # XXX caching?
333 obj = self.obj
334 compat_co_firstlineno = getattr(obj, "compat_co_firstlineno", None)
335 if isinstance(compat_co_firstlineno, int):
336 # nose compatibility
337 file_path = sys.modules[obj.__module__].__file__
338 if file_path.endswith(".pyc"):
339 file_path = file_path[:-1]
340 path: Union["os.PathLike[str]", str] = file_path
341 lineno = compat_co_firstlineno
342 else:
343 path, lineno = getfslineno(obj)
344 modpath = self.getmodpath()
345 assert isinstance(lineno, int)
346 return path, lineno, modpath
347
348
349# As an optimization, these builtin attribute names are pre-ignored when

Callers

nothing calls this directly

Calls 2

getmodpathMethod · 0.95
getfslinenoFunction · 0.90

Tested by

no test coverage detected