(self)
| 379 | pass |
| 380 | |
| 381 | def runtest(self) -> None: |
| 382 | from _pytest.debugging import maybe_wrap_pytest_function_for_tracing |
| 383 | |
| 384 | testcase = self.instance |
| 385 | assert testcase is not None |
| 386 | |
| 387 | maybe_wrap_pytest_function_for_tracing(self) |
| 388 | |
| 389 | # Let the unittest framework handle async functions. |
| 390 | if is_async_function(self.obj): |
| 391 | testcase(result=self) |
| 392 | else: |
| 393 | # When --pdb is given, we want to postpone calling tearDown() otherwise |
| 394 | # when entering the pdb prompt, tearDown() would have probably cleaned up |
| 395 | # instance variables, which makes it difficult to debug. |
| 396 | # Arguably we could always postpone tearDown(), but this changes the moment where the |
| 397 | # TestCase instance interacts with the results object, so better to only do it |
| 398 | # when absolutely needed. |
| 399 | # We need to consider if the test itself is skipped, or the whole class. |
| 400 | assert isinstance(self.parent, UnitTestCase) |
| 401 | skipped = _is_skipped(self.obj) or _is_skipped(self.parent.obj) |
| 402 | if self.config.getoption("usepdb") and not skipped: |
| 403 | self._explicit_tearDown = testcase.tearDown |
| 404 | setattr(testcase, "tearDown", lambda *args: None) |
| 405 | |
| 406 | # We need to update the actual bound method with self.obj, because |
| 407 | # wrap_pytest_function_for_tracing replaces self.obj by a wrapper. |
| 408 | setattr(testcase, self.name, self.obj) |
| 409 | try: |
| 410 | testcase(result=self) |
| 411 | finally: |
| 412 | delattr(testcase, self.name) |
| 413 | |
| 414 | def _traceback_filter( |
| 415 | self, excinfo: _pytest._code.ExceptionInfo[BaseException] |
nothing calls this directly
no test coverage detected