ensure OutcomeExceptions like skip/fail have initialized exception attributes

This commit is contained in:
Ronny Pfannschmidt 2013-01-27 02:06:19 +01:00
parent 51b40dd22c
commit 570688f701
3 changed files with 7 additions and 0 deletions

View File

@ -19,6 +19,8 @@ Changes between 2.3.4 and 2.3.5dev
- improve PYTEST_DEBUG tracing output by puting
extra data on a new lines with additional indent
- ensure OutcomeExceptions like skip/fail have initialized exception attributes
Changes between 2.3.3 and 2.3.4
-----------------------------------

View File

@ -364,6 +364,7 @@ class OutcomeException(Exception):
contain info about test and collection outcomes.
"""
def __init__(self, msg=None, pytrace=True):
super(OutcomeException, self).__init__(msg)
self.msg = msg
self.pytrace = pytrace

View File

@ -378,6 +378,10 @@ def test_runtest_in_module_ordering(testdir):
])
def test_outcomeexception_exceptionattributes():
outcome = runner.OutcomeException('test')
assert outcome.message == outcome.msg
def test_pytest_exit():
try:
py.test.exit("hello")