(self, pytester: Pytester, pytestconfig: Config)
| 442 | assert new_rep.outcome == rep.outcome |
| 443 | |
| 444 | def test_collect_report(self, pytester: Pytester, pytestconfig: Config) -> None: |
| 445 | pytester.makepyfile( |
| 446 | """ |
| 447 | def test_a(): assert False |
| 448 | def test_b(): pass |
| 449 | """ |
| 450 | ) |
| 451 | reprec = pytester.inline_run() |
| 452 | reports = reprec.getreports("pytest_collectreport") |
| 453 | assert len(reports) == 2 |
| 454 | for rep in reports: |
| 455 | data = pytestconfig.hook.pytest_report_to_serializable( |
| 456 | config=pytestconfig, report=rep |
| 457 | ) |
| 458 | assert data["$report_type"] == "CollectReport" |
| 459 | new_rep = pytestconfig.hook.pytest_report_from_serializable( |
| 460 | config=pytestconfig, data=data |
| 461 | ) |
| 462 | assert new_rep.nodeid == rep.nodeid |
| 463 | assert new_rep.when == "collect" |
| 464 | assert new_rep.outcome == rep.outcome |
| 465 | |
| 466 | @pytest.mark.parametrize( |
| 467 | "hook_name", ["pytest_runtest_logreport", "pytest_collectreport"] |
nothing calls this directly
no test coverage detected