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

Function pytest_pycollect_makeitem

src/_pytest/unittest.py:44–57  ·  view source on GitHub ↗
(
    collector: PyCollector, name: str, obj: object
)

Source from the content-addressed store, hash-verified

42
43
44def pytest_pycollect_makeitem(
45 collector: PyCollector, name: str, obj: object
46) -> Optional["UnitTestCase"]:
47 # Has unittest been imported and is obj a subclass of its TestCase?
48 try:
49 ut = sys.modules["unittest"]
50 # Type ignored because `ut` is an opaque module.
51 if not issubclass(obj, ut.TestCase): # type: ignore
52 return None
53 except Exception:
54 return None
55 # Yes, so let's collect it.
56 item: UnitTestCase = UnitTestCase.from_parent(collector, name=name, obj=obj)
57 return item
58
59
60class UnitTestCase(Class):

Callers

nothing calls this directly

Calls 1

from_parentMethod · 0.45

Tested by

no test coverage detected