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

Method getpathnode

src/_pytest/pytester.py:985–1000  ·  view source on GitHub ↗

Return the collection node of a file. This is like :py:meth:`getnode` but uses :py:meth:`parseconfigure` to create the (configured) pytest Config instance. :param os.PathLike[str] path: Path to the file.

(self, path: Union[str, "os.PathLike[str]"])

Source from the content-addressed store, hash-verified

983 return res
984
985 def getpathnode(self, path: Union[str, "os.PathLike[str]"]):
986 """Return the collection node of a file.
987
988 This is like :py:meth:`getnode` but uses :py:meth:`parseconfigure` to
989 create the (configured) pytest Config instance.
990
991 :param os.PathLike[str] path: Path to the file.
992 """
993 path = Path(path)
994 config = self.parseconfigure(path)
995 session = Session.from_config(config)
996 x = bestrelpath(session.path, path)
997 config.hook.pytest_sessionstart(session=session)
998 res = session.perform_collect([x], genitems=False)[0]
999 config.hook.pytest_sessionfinish(session=session, exitstatus=ExitCode.OK)
1000 return res
1001
1002 def genitems(self, colitems: Sequence[Union[Item, Collector]]) -> List[Item]:
1003 """Generate all test items from a collection node.

Callers 1

Calls 6

parseconfigureMethod · 0.95
bestrelpathFunction · 0.90
perform_collectMethod · 0.80
from_configMethod · 0.45
pytest_sessionstartMethod · 0.45
pytest_sessionfinishMethod · 0.45

Tested by

no test coverage detected