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

Function pytest_collect_file

src/_pytest/python.py:195–207  ·  view source on GitHub ↗
(file_path: Path, parent: nodes.Collector)

Source from the content-addressed store, hash-verified

193
194
195def pytest_collect_file(file_path: Path, parent: nodes.Collector) -> Module | None:
196 if file_path.suffix == ".py":
197 if not parent.session.isinitpath(file_path):
198 if not path_matches_patterns(
199 file_path, parent.config.getini("python_files")
200 ):
201 return None
202 ihook = parent.session.gethookproxy(file_path)
203 module: Module = ihook.pytest_pycollect_makemodule(
204 module_path=file_path, parent=parent
205 )
206 return module
207 return None
208
209
210def path_matches_patterns(path: Path, patterns: Iterable[str]) -> bool:

Callers

nothing calls this directly

Calls 4

path_matches_patternsFunction · 0.85
gethookproxyMethod · 0.80
isinitpathMethod · 0.45
getiniMethod · 0.45

Tested by

no test coverage detected