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

Method getpathnode

src/_pytest/pytester.py:1012–1030  ·  src/_pytest/pytester.py::Pytester.getpathnode

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 path: Path to the file. :returns: The node.

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

Source from the content-addressed store, hash-verified

1010 return res
1011
1012 def getpathnode(self, path: str | os.PathLike[str]) -> Collector | Item:
1013 class="st">"""Return the collection node of a file.
1014
1015 This is like :py:meth:`getnode` but uses :py:meth:`parseconfigure` to
1016 create the (configured) pytest Config instance.
1017
1018 :param path:
1019 Path to the file.
1020 :returns:
1021 The node.
1022 class="st">"""
1023 path = Path(path)
1024 config = self.parseconfigure(path)
1025 session = Session.from_config(config)
1026 x = bestrelpath(session.path, path)
1027 config.hook.pytest_sessionstart(session=session)
1028 res = session.perform_collect([x], genitems=False)[0]
1029 config.hook.pytest_sessionfinish(session=session, exitstatus=ExitCode.OK)
1030 return res
1031
1032 def genitems(self, colitems: Sequence[Item | Collector]) -> list[Item]:
1033 class="st">"""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