diff options
author | Florian Dahlitz <f2dahlitz@freenet.de> | 2020-05-22 22:58:35 +0200 |
---|---|---|
committer | Florian Dahlitz <f2dahlitz@freenet.de> | 2020-05-22 22:58:35 +0200 |
commit | d0eb86cfa671057c678a90ac10c1a43be11bdf6a (patch) | |
tree | 69c07267eab6e81ab7ecca53505ca68c71f0f533 /src/_pytest/debugging.py | |
parent | 4a1557fa0e04132eb847d4a5d01c77f0ab777c5a (diff) | |
download | pytest-d0eb86cfa671057c678a90ac10c1a43be11bdf6a.tar.gz |
Prevent hiding underlying exception when ConfTestImportFailure is raised
Diffstat (limited to 'src/_pytest/debugging.py')
-rw-r--r-- | src/_pytest/debugging.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/_pytest/debugging.py b/src/_pytest/debugging.py index 17915db73..26c3095dc 100644 --- a/src/_pytest/debugging.py +++ b/src/_pytest/debugging.py @@ -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] |