testing/example_scripts/fixtures/custom_item/conftest.py
raw| 1 | # mypy: allow-untyped-defs |
| 2 | from __future__ import annotations |
| 3 | |
| 4 | import pytest |
| 5 | |
| 6 | |
| 7 | class CustomItem(pytest.Item): |
| 8 | def runtest(self): |
| 9 | pass |
| 10 | |
| 11 | |
| 12 | class CustomFile(pytest.File): |
| 13 | def collect(self): |
| 14 | yield CustomItem.from_parent(name="foo", parent=self) |
| 15 | |
| 16 | |
| 17 | def pytest_collect_file(file_path, parent): |
| 18 | return CustomFile.from_parent(path=file_path, parent=parent) |