CollectError.repr_failure: honor explicit tbstyle option

This commit is contained in:
Daniel Hahler
2019-03-23 15:18:22 +01:00
parent 15d608867d
commit de44293d59
2 changed files with 26 additions and 1 deletions

View File

@@ -325,7 +325,14 @@ class Collector(Node):
if excinfo.errisinstance(self.CollectError):
exc = excinfo.value
return str(exc.args[0])
return self._repr_failure_py(excinfo, style="short")
# Respect explicit tbstyle option, but default to "short"
# (None._repr_failure_py defaults to "long" without "fulltrace" option).
tbstyle = self.config.getoption("tbstyle")
if tbstyle == "auto":
tbstyle = "short"
return self._repr_failure_py(excinfo, style=tbstyle)
def _prunetraceback(self, excinfo):
if hasattr(self, "fspath"):