*Not documented*
def repr_failure_explanation(self, excinfo, source):
origin: test.TerminalSession
where:
function source:
def repr_failure_explanation(self, excinfo, source):
try:
s = str(source.getstatement(len(source)-1))
except KeyboardInterrupt:
raise
except:
s = str(source[-1])
indent = " " * (4 + (len(s) - len(s.lstrip())))
# get the real exception information out
lines = excinfo.exconly(tryshort=True).split('\n')
self.out.line('>' + indent[:-1] + lines.pop(0))
for x in lines:
self.out.line(indent + x)
return
# XXX reinstate the following with a --magic option?
# the following line gets user-supplied messages (e.g.
# for "assert 0, 'custom message'")
msg = getattr(getattr(excinfo, 'value', ''), 'msg', '')
info = None
if not msg:
special = excinfo.errisinstance((SyntaxError, SystemExit, KeyboardInterrupt))
if not self.config.option.nomagic and not special:
try:
info = excinfo.traceback[-1].reinterpret() # very detailed info
except KeyboardInterrupt:
raise
except:
if self.config.option.verbose >= 1:
self.out.line("[reinterpretation traceback]")
py.std.traceback.print_exc(file=py.std.sys.stdout)
else:
self.out.line("[reinterpretation failed, increase "
"verbosity to see details]")
# print reinterpreted info if any
if info:
lines = info.split('\n')
self.out.line('>' + indent[:-1] + lines.pop(0))
for x in lines:
self.out.line(indent + x)
called in /home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py
traceback test.TerminalSession.repr_failure_explanation.0
called in /home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py
traceback test.TerminalSession.repr_failure_explanation.1
called in /home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py
traceback test.TerminalSession.repr_failure_explanation.2
called in /home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py
traceback test.TerminalSession.repr_failure_explanation.3
called in /home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py
traceback test.TerminalSession.repr_failure_explanation.4
called in /home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py
traceback test.TerminalSession.repr_failure_explanation.5
called in /home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py
traceback test.TerminalSession.repr_failure_explanation.6
called in /home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py
traceback test.TerminalSession.repr_failure_explanation.7
called in /home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py
traceback test.TerminalSession.repr_failure_explanation.8
called in /home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py
traceback test.TerminalSession.repr_failure_explanation.9
called in /home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py
traceback test.TerminalSession.repr_failure_explanation.10
called in /home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py
traceback test.TerminalSession.repr_failure_explanation.11
called in /home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py
traceback test.TerminalSession.repr_failure_explanation.12
called in /home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py
traceback test.TerminalSession.repr_failure_explanation.13
called in /home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py