diff --git a/AUTHORS b/AUTHORS index fd543b145..c1dec8150 100644 --- a/AUTHORS +++ b/AUTHORS @@ -59,6 +59,7 @@ Jaap Broekhuizen Jan Balster Janne Vanhala Jason R. Coombs +Javier Domingo Cansino John Towler Joshua Bronson Jurko Gospodnetić diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e67cffc70..6d754d929 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,7 +14,7 @@ level an error will be raised during collection. Thanks `@omarkohl`_ for the complete PR (`#1519`_). -* +* Fix (`1516`_): ConftestImportFailure now shows the traceback **Incompatible changes** diff --git a/_pytest/config.py b/_pytest/config.py index 463d8f04f..577425d6a 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -25,6 +25,12 @@ class ConftestImportFailure(Exception): self.path = path self.excinfo = excinfo + def __str__(self): + etype, evalue, etb = self.excinfo + formatted = traceback.format_tb(etb) + # The level of the tracebacks we want to print is hand crafted :( + return repr(evalue) + '\n' + ''.join(formatted[2:]) + def main(args=None, plugins=None): """ return exit code, after performing an in-process test run.