Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions changelog/12235.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Documented why ``OutcomeException`` derives from ``BaseException``.
7 changes: 5 additions & 2 deletions src/_pytest/outcomes.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@


class OutcomeException(BaseException):
"""OutcomeException and its subclass instances indicate and contain info
about test and collection outcomes."""
"""Signals a test or collection outcome (skip, fail, xfail, ...).
Derives from BaseException so ``except Exception:`` won't swallow it.
Catch it only to re-raise.
"""

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