Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up to use pytest for our data-driven tests, and switch testcheck over to it #1944

Merged
merged 15 commits into from
Jul 27, 2016
Prev Previous commit
Next Next commit
print traceback, except on SystemExit
  • Loading branch information
gnprice committed Jul 27, 2016
commit a030509d8cadc318c0fabc77ca12f63c2242534c
12 changes: 11 additions & 1 deletion mypy/test/collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,14 @@ def reportinfo(self):
return self.obj.file, self.obj.line, self.obj.name

def repr_failure(self, excinfo):
return "data: {}:{}\n{}".format(self.obj.file, self.obj.line, excinfo.exconly())
if excinfo.errisinstance(SystemExit):
# We assume that before doing exit() (which raises SystemExit) we've printed
# enough context about what happened so that a stack trace is not useful.
# In particular, uncaught exceptions during semantic analysis or type checking
# call exit() and they already print out a stack trace.
excrepr = excinfo.exconly()
else:
self.parent._prunetraceback(excinfo)
excrepr = excinfo.getrepr(style='short')

return "data: {}:{}\n{}".format(self.obj.file, self.obj.line, excrepr)