diff --git a/_pytest/main.py b/_pytest/main.py index f608a7ecd5c..4a6c0877557 100644 --- a/_pytest/main.py +++ b/_pytest/main.py @@ -392,7 +392,10 @@ def _repr_failure_py(self, excinfo, style=None): if self.config.option.fulltrace: style="long" else: + tb = _pytest._code.Traceback([excinfo.traceback[-1]]) self._prunetraceback(excinfo) + if len(excinfo.traceback) == 0: + excinfo.traceback = tb tbfilter = False # prunetraceback already does it if style == "auto": style = "long"