diff --git a/CHANGELOG b/CHANGELOG index 641bbf708..9d8202e63 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 ----------------------------------- diff --git a/_pytest/runner.py b/_pytest/runner.py index 01e6a4840..24abfb76b 100644 --- a/_pytest/runner.py +++ b/_pytest/runner.py @@ -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 diff --git a/testing/test_runner.py b/testing/test_runner.py index 54009f066..25e3df28a 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -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")