File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change
1
+ Prevent hiding the underlying exception when ``ConfTestImportFailure `` is raised.
Original file line number Diff line number Diff line change 4
4
import sys
5
5
6
6
from _pytest import outcomes
7
+ from _pytest .config import ConftestImportFailure
7
8
from _pytest .config import hookimpl
8
9
from _pytest .config .exceptions import UsageError
9
10
@@ -338,6 +339,10 @@ def _postmortem_traceback(excinfo):
338
339
# A doctest.UnexpectedException is not useful for post_mortem.
339
340
# Use the underlying exception instead:
340
341
return excinfo .value .exc_info [2 ]
342
+ elif isinstance (excinfo .value , ConftestImportFailure ):
343
+ # A config.ConftestImportFailure is not useful for post_mortem.
344
+ # Use the underlying exception instead:
345
+ return excinfo .value .excinfo [2 ]
341
346
else :
342
347
return excinfo ._excinfo [2 ]
343
348
You can’t perform that action at this time.
0 commit comments