Return a representation of a collection failure. :param excinfo: Exception information for the failure.
( # type: ignore[override]
self, excinfo: ExceptionInfo[BaseException]
)
| 505 | |
| 506 | # TODO: This omits the style= parameter which breaks Liskov Substitution. |
| 507 | def repr_failure( # type: ignore[override] |
| 508 | self, excinfo: ExceptionInfo[BaseException] |
| 509 | ) -> str | TerminalRepr: |
| 510 | """Return a representation of a collection failure. |
| 511 | |
| 512 | :param excinfo: Exception information for the failure. |
| 513 | """ |
| 514 | if isinstance(excinfo.value, self.CollectError) and not self.config.getoption( |
| 515 | "fulltrace", False |
| 516 | ): |
| 517 | exc = excinfo.value |
| 518 | return str(exc.args[0]) |
| 519 | |
| 520 | # Respect explicit tbstyle option, but default to "short" |
| 521 | # (_repr_failure_py uses "long" with "fulltrace" option always). |
| 522 | tbstyle = self.config.getoption("tbstyle", "auto") |
| 523 | if tbstyle == "auto": |
| 524 | tbstyle = "short" |
| 525 | |
| 526 | return self._repr_failure_py(excinfo, style=tbstyle) |
| 527 | |
| 528 | def _traceback_filter(self, excinfo: ExceptionInfo[BaseException]) -> Traceback: |
| 529 | if hasattr(self, "path"): |
nothing calls this directly
no test coverage detected