(self, pytester: Pytester)
| 101 | assert fn.function is not None |
| 102 | |
| 103 | def test_getcustomfile_roundtrip(self, pytester: Pytester) -> None: |
| 104 | hello = pytester.makefile(".xxx", hello="world") |
| 105 | pytester.makepyfile( |
| 106 | conftest=""" |
| 107 | import pytest |
| 108 | class CustomFile(pytest.File): |
| 109 | def collect(self): |
| 110 | return [] |
| 111 | def pytest_collect_file(file_path, parent): |
| 112 | if file_path.suffix == ".xxx": |
| 113 | return CustomFile.from_parent(path=file_path, parent=parent) |
| 114 | """ |
| 115 | ) |
| 116 | node = pytester.getpathnode(hello) |
| 117 | assert isinstance(node, pytest.File) |
| 118 | assert node.name == "hello.xxx" |
| 119 | nodes = node.session.perform_collect([node.nodeid], genitems=False) |
| 120 | assert len(nodes) == 1 |
| 121 | assert isinstance(nodes[0], pytest.File) |
| 122 | |
| 123 | def test_can_skip_class_with_test_attr(self, pytester: Pytester) -> None: |
| 124 | """Assure test class is skipped when using `__test__=False` (See #2007).""" |
nothing calls this directly
no test coverage detected