Merge pull request #4987 from blueyed/collect-tbstyle-repr_failure

CollectError.repr_failure: honor explicit tbstyle option
This commit is contained in:
Bruno Oliveira
2019-03-26 18:37:49 -03:00
committed by GitHub
3 changed files with 27 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"):