Prevent hiding underlying exception when ConfTestImportFailure is raised
This commit is contained in:
parent
4a1557fa0e
commit
d0eb86cfa6
|
@ -0,0 +1 @@
|
|||
Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised.
|
|
@ -4,6 +4,7 @@ import functools
|
|||
import sys
|
||||
|
||||
from _pytest import outcomes
|
||||
from _pytest.config import ConftestImportFailure
|
||||
from _pytest.config import hookimpl
|
||||
from _pytest.config.exceptions import UsageError
|
||||
|
||||
|
@ -338,6 +339,10 @@ def _postmortem_traceback(excinfo):
|
|||
# A doctest.UnexpectedException is not useful for post_mortem.
|
||||
# Use the underlying exception instead:
|
||||
return excinfo.value.exc_info[2]
|
||||
elif isinstance(excinfo.value, ConftestImportFailure):
|
||||
# A config.ConftestImportFailure is not useful for post_mortem.
|
||||
# Use the underlying exception instead:
|
||||
return excinfo.value.excinfo[2]
|
||||
else:
|
||||
return excinfo._excinfo[2]
|
||||
|
||||
|
|
Loading…
Reference in New Issue