MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_collect_report

Method test_collect_report

testing/test_reports.py:444–464  ·  view source on GitHub ↗
(self, pytester: Pytester, pytestconfig: Config)

Source from the content-addressed store, hash-verified

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"]

Callers

nothing calls this directly

Calls 3

makepyfileMethod · 0.45
inline_runMethod · 0.45
getreportsMethod · 0.45

Tested by

no test coverage detected