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

Method collect

doc/en/example/customdirectory/conftest.py:10–21  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

8
9class ManifestDirectory(pytest.Directory):
10 def collect(self):
11 # The standard pytest behavior is to loop over all `test_*.py` files and
12 # call `pytest_collect_file` on each file. This collector instead reads
13 # the `manifest.json` file and only calls `pytest_collect_file` for the
14 # files defined there.
15 manifest_path = self.path / "manifest.json"
16 manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
17 ihook = self.ihook
18 for file in manifest["files"]:
19 yield from ihook.pytest_collect_file(
20 file_path=self.path / file, parent=self
21 )
22
23
24@pytest.hookimpl

Callers

nothing calls this directly

Calls 2

read_textMethod · 0.80
pytest_collect_fileMethod · 0.80

Tested by

no test coverage detected