MCPcopy
hub / github.com/marimo-team/marimo / pytest_make_collect_report

Function pytest_make_collect_report

tests/conftest.py:570–644  ·  view source on GitHub ↗
(collector)

Source from the content-addressed store, hash-verified

568# ./test_pytest_scoped
569@pytest.hookimpl
570def pytest_make_collect_report(collector):
571 # If it's not a module, we must early.
572 if not isinstance(collector, pytest.Module):
573 return None
574
575 report = runner.pytest_make_collect_report(collector)
576
577 # Defined within the file does not seem to hook correctly, as such filter
578 # for the test_pytest specific file here.
579 if not (
580 "test_pytest" in str(collector.path) and "_ast" in str(collector.path)
581 ):
582 return report
583
584 # Classes may also be registered, but they will be hidden behind a cell.
585 # As such, let's just collect functions.
586 collected = {
587 fn.originalname
588 for fn in collector.collect()
589 if isinstance(fn, pytest.Function)
590 }
591 classes = {
592 cls.name
593 for cls in collector.collect()
594 if isinstance(cls, pytest.Class)
595 }
596 from tests._ast.test_pytest import app as app_pytest
597 from tests._ast.test_pytest_scoped import app as app_scoped
598 from tests._ast.test_pytest_toplevel import app as app_toplevel
599
600 app = {
601 "test_pytest": app_pytest,
602 "test_pytest_toplevel": app_toplevel,
603 "test_pytest_scoped": app_scoped,
604 }[collector.path.stem]
605
606 # Just a quick check to make sure the class is actually exported.
607 if app == app_pytest and len(classes) == 0:
608 report.outcome = "failed"
609 report.longrepr = (
610 f"Expected class in {collector.path}, found none "
611 " (tests/conftest.py)."
612 )
613 return report
614 for cls in classes:
615 if not (
616 cls.startswith("MarimoTestBlock")
617 or cls
618 in (
619 "TestClassWorks",
620 "TestClassWithFixtures",
621 "TestClassDefinitionWithFixtures",
622 )
623 ):
624 report.outcome = "failed"
625 report.longrepr = (
626 f"Unknown class '{cls}' in {collector.path}"
627 " (tests/conftest.py)."

Callers

nothing calls this directly

Calls 4

collectMethod · 0.45
namesMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…