(self)
| 63 | nofuncargs = True |
| 64 | |
| 65 | def collect(self) -> Iterable[Union[Item, Collector]]: |
| 66 | from unittest import TestLoader |
| 67 | |
| 68 | cls = self.obj |
| 69 | if not getattr(cls, "__test__", True): |
| 70 | return |
| 71 | |
| 72 | skipped = _is_skipped(cls) |
| 73 | if not skipped: |
| 74 | self._inject_setup_teardown_fixtures(cls) |
| 75 | self._inject_setup_class_fixture() |
| 76 | |
| 77 | self.session._fixturemanager.parsefactories(self, unittest=True) |
| 78 | loader = TestLoader() |
| 79 | foundsomething = False |
| 80 | for name in loader.getTestCaseNames(self.obj): |
| 81 | x = getattr(self.obj, name) |
| 82 | if not getattr(x, "__test__", True): |
| 83 | continue |
| 84 | funcobj = getimfunc(x) |
| 85 | yield TestCaseFunction.from_parent(self, name=name, callobj=funcobj) |
| 86 | foundsomething = True |
| 87 | |
| 88 | if not foundsomething: |
| 89 | runtest = getattr(self.obj, "runTest", None) |
| 90 | if runtest is not None: |
| 91 | ut = sys.modules.get("twisted.trial.unittest", None) |
| 92 | # Type ignored because `ut` is an opaque module. |
| 93 | if ut is None or runtest != ut.TestCase.runTest: # type: ignore |
| 94 | yield TestCaseFunction.from_parent(self, name="runTest") |
| 95 | |
| 96 | def _inject_setup_teardown_fixtures(self, cls: type) -> None: |
| 97 | """Injects a hidden auto-use fixture to invoke setUpClass/setup_method and corresponding |
nothing calls this directly
no test coverage detected