Return the collection node of a file. :param pytest.Config config: A pytest config. See :py:meth:`parseconfig` and :py:meth:`parseconfigure` for creating it. :param os.PathLike[str] arg: Path to the file.
(
self, config: Config, arg: Union[str, "os.PathLike[str]"]
)
| 964 | ) |
| 965 | |
| 966 | def getnode( |
| 967 | self, config: Config, arg: Union[str, "os.PathLike[str]"] |
| 968 | ) -> Optional[Union[Collector, Item]]: |
| 969 | """Return the collection node of a file. |
| 970 | |
| 971 | :param pytest.Config config: |
| 972 | A pytest config. |
| 973 | See :py:meth:`parseconfig` and :py:meth:`parseconfigure` for creating it. |
| 974 | :param os.PathLike[str] arg: |
| 975 | Path to the file. |
| 976 | """ |
| 977 | session = Session.from_config(config) |
| 978 | assert "::" not in str(arg) |
| 979 | p = Path(os.path.abspath(arg)) |
| 980 | config.hook.pytest_sessionstart(session=session) |
| 981 | res = session.perform_collect([str(p)], genitems=False)[0] |
| 982 | config.hook.pytest_sessionfinish(session=session, exitstatus=ExitCode.OK) |
| 983 | return res |
| 984 | |
| 985 | def getpathnode(self, path: Union[str, "os.PathLike[str]"]): |
| 986 | """Return the collection node of a file. |
no test coverage detected