Skip to content

Commit

Permalink
unify outcome exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
RonnyPfannschmidt committed Oct 10, 2017
1 parent 69d4cf0 commit 5498fba
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions _pytest/outcomes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
import attr


@attr.s(frozen=True)
# str = true ensures repr uses str
exc = attr.s(frozen=True)

@exc
class OutcomeException(BaseException):
""" OutcomeException and its subclass instances indicate and
contain info about test and collection outcomes.
Expand All @@ -31,7 +34,7 @@ def __repr__(self):
TEST_OUTCOME = (OutcomeException, Exception)


@attr.s(frozen=True)
@exc
class Skipped(OutcomeException):
# XXX hackish: on 3k we fake to live in the builtins
# in order to have Skipped exception printing shorter/nicer
Expand All @@ -49,11 +52,13 @@ class Failed(OutcomeException):
__module__ = 'builtins'


@attr.s(frozen=True)
@exc
class Exit(KeyboardInterrupt):
""" raised for immediate program exits (no tracebacks/summaries)"""
msg = attr.ib(default="unknown reason")

def __str__(self):
return self.msg

# exposed helper methods

Expand Down

0 comments on commit 5498fba

Please sign in to comment.