(
collector: PyCollector, name: str, obj: object
)
| 42 | |
| 43 | |
| 44 | def 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 | |
| 60 | class UnitTestCase(Class): |
nothing calls this directly
no test coverage detected