Ensure File.from_parent can forward custom arguments to the constructor. Context: https://github.com/pytest-dev/pytest-cpp/pull/47
(pytester: Pytester, request: FixtureRequest)
| 1369 | |
| 1370 | |
| 1371 | def test_fscollector_from_parent(pytester: Pytester, request: FixtureRequest) -> None: |
| 1372 | """Ensure File.from_parent can forward custom arguments to the constructor. |
| 1373 | |
| 1374 | Context: https://github.com/pytest-dev/pytest-cpp/pull/47 |
| 1375 | """ |
| 1376 | |
| 1377 | class MyCollector(pytest.File): |
| 1378 | def __init__(self, *k, x, **kw): |
| 1379 | super().__init__(*k, **kw) |
| 1380 | self.x = x |
| 1381 | |
| 1382 | collector = MyCollector.from_parent( |
| 1383 | parent=request.session, path=pytester.path / "foo", x=10 |
| 1384 | ) |
| 1385 | assert collector.x == 10 |
| 1386 | |
| 1387 | |
| 1388 | def test_class_from_parent(pytester: Pytester, request: FixtureRequest) -> None: |
nothing calls this directly
no test coverage detected