Closed
Description
py.test pytest (2.8.5) does not print chained exceptions, data located in e.__cause__
and e.__context__
.
If I execute this little script using python3 (python3 test_exception.py
):
def test_x():
try:
raise KeyError
except Exception as e:
raise RuntimeError from e
if __name__ == '__main__':
test_x()
I get:
Traceback (most recent call last):
File "py_test.py", line 4, in test_x
raise KeyError
KeyError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "py_test.py", line 9, in <module>
test_x()
File "py_test.py", line 6, in test_x
raise RuntimeError from e
RuntimeError
in case of py.test (py.test test_exception.py
):
def test_x():
try:
raise KeyError
except Exception as e:
> raise RuntimeError from e
E RuntimeError
py_test.py:6: RuntimeError
Metadata
Metadata
Assignees
Labels
No labels