Get the collection node of a file. :param config: A pytest config. See :py:meth:`parseconfig` and :py:meth:`parseconfigure` for creating it. :param arg: Path to the file. :returns: The node.
(self, config: Config, arg: str | os.PathLike[str])
| 991 | ) |
| 992 | |
| 993 | def getnode(self, config: Config, arg: str | os.PathLike[str]) -> Collector | Item: |
| 994 | """Get the collection node of a file. |
| 995 | |
| 996 | :param config: |
| 997 | A pytest config. |
| 998 | See :py:meth:`parseconfig` and :py:meth:`parseconfigure` for creating it. |
| 999 | :param arg: |
| 1000 | Path to the file. |
| 1001 | :returns: |
| 1002 | The node. |
| 1003 | """ |
| 1004 | session = Session.from_config(config) |
| 1005 | assert "::" not in str(arg) |
| 1006 | p = Path(os.path.abspath(arg)) |
| 1007 | config.hook.pytest_sessionstart(session=session) |
| 1008 | res = session.perform_collect([str(p)], genitems=False)[0] |
| 1009 | config.hook.pytest_sessionfinish(session=session, exitstatus=ExitCode.OK) |
| 1010 | return res |
| 1011 | |
| 1012 | def getpathnode(self, path: str | os.PathLike[str]) -> Collector | Item: |
| 1013 | """Return the collection node of a file. |
no test coverage detected