Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/_pytest/outcomes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@

class OutcomeException(BaseException):
"""OutcomeException and its subclass instances indicate and contain info
about test and collection outcomes."""
about test and collection outcomes.

Inherits from :class:`BaseException` rather than :class:`Exception` so that
broad ``except Exception:`` handlers in user code or tests do not
accidentally swallow pytest outcomes (such as :func:`pytest.skip`,
:func:`pytest.fail`, or :func:`pytest.xfail`) without re-raising them.
"""

def __init__(self, msg: str | None = None, pytrace: bool = True) -> None:
if msg is not None and not isinstance(msg, str):
Expand Down
Loading