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

Function pytest_collect_file

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected