(
self, pytester: Pytester, recwarn
)
| 43 | assert clscol.funcargs["arg1"] == 42 |
| 44 | |
| 45 | def test_autouse_fixture( |
| 46 | self, pytester: Pytester, recwarn |
| 47 | ) -> None: # rough jstests usage |
| 48 | pytester.makeconftest( |
| 49 | """ |
| 50 | import pytest |
| 51 | def pytest_pycollect_makeitem(collector, name, obj): |
| 52 | if name == "MyClass": |
| 53 | return MyCollector.from_parent(collector, name=name) |
| 54 | class MyCollector(pytest.Collector): |
| 55 | def reportinfo(self): |
| 56 | return self.path, 3, "xyz" |
| 57 | """ |
| 58 | ) |
| 59 | modcol = pytester.getmodulecol( |
| 60 | """ |
| 61 | import pytest |
| 62 | @pytest.fixture(autouse=True) |
| 63 | def hello(): |
| 64 | pass |
| 65 | @pytest.fixture |
| 66 | def arg1(request): |
| 67 | return 42 |
| 68 | class MyClass(object): |
| 69 | pass |
| 70 | """ |
| 71 | ) |
| 72 | # this hook finds funcarg factories |
| 73 | rep = runner.collect_one_node(modcol) |
| 74 | # TODO: Don't treat as Any. |
| 75 | clscol: Any = rep.result[0] |
| 76 | clscol.obj = lambda: None |
| 77 | clscol.funcargs = {} |
| 78 | pytest._fillfuncargs(clscol) |
| 79 | assert not clscol.funcargs |
| 80 | |
| 81 | |
| 82 | def test_wrapped_getfslineno() -> None: |
nothing calls this directly
no test coverage detected