(self, pytester: Pytester, pytestconfig: Config)
| 420 | """Test that the hooks are working correctly for plugins""" |
| 421 | |
| 422 | def test_test_report(self, pytester: Pytester, pytestconfig: Config) -> None: |
| 423 | pytester.makepyfile( |
| 424 | """ |
| 425 | def test_a(): assert False |
| 426 | def test_b(): pass |
| 427 | """ |
| 428 | ) |
| 429 | reprec = pytester.inline_run() |
| 430 | reports = reprec.getreports("pytest_runtest_logreport") |
| 431 | assert len(reports) == 6 |
| 432 | for rep in reports: |
| 433 | data = pytestconfig.hook.pytest_report_to_serializable( |
| 434 | config=pytestconfig, report=rep |
| 435 | ) |
| 436 | assert data["$report_type"] == "TestReport" |
| 437 | new_rep = pytestconfig.hook.pytest_report_from_serializable( |
| 438 | config=pytestconfig, data=data |
| 439 | ) |
| 440 | assert new_rep.nodeid == rep.nodeid |
| 441 | assert new_rep.when == rep.when |
| 442 | assert new_rep.outcome == rep.outcome |
| 443 | |
| 444 | def test_collect_report(self, pytester: Pytester, pytestconfig: Config) -> None: |
| 445 | pytester.makepyfile( |
nothing calls this directly
no test coverage detected