pdb plugin: move entering pdb into a toplevel function

this prepares pdb at collect time
This commit is contained in:
Ronny Pfannschmidt 2013-04-18 11:18:24 +02:00
parent 55c349a9eb
commit cf7cae0780
1 changed files with 19 additions and 13 deletions

View File

@ -61,20 +61,26 @@ class PdbInvoke:
return rep return rep
if hasattr(rep, "wasxfail"): if hasattr(rep, "wasxfail"):
return rep return rep
# we assume that the above execute() suspended capturing return _enter_pdb(item, call.excinfo, rep)
# XXX we re-use the TerminalReporter's terminalwriter
# because this seems to avoid some encoding related troubles
# for not completely clear reasons.
tw = item.config.pluginmanager.getplugin("terminalreporter")._tw
tw.line()
tw.sep(">", "traceback")
rep.toterminal(tw)
tw.sep(">", "entering PDB")
tb = _postmortem_traceback(call.excinfo)
post_mortem(tb)
rep._pdbshown = True
return rep def _enter_pdb(item, excinfo, rep):
# we assume that the above execute() suspended capturing
# XXX we re-use the TerminalReporter's terminalwriter
# because this seems to avoid some encoding related troubles
# for not completely clear reasons.
tw = item.config.pluginmanager.getplugin("terminalreporter")._tw
tw.line()
tw.sep(">", "traceback")
rep.toterminal(tw)
tw.sep(">", "entering PDB")
tb = _postmortem_traceback(excinfo)
post_mortem(tb)
rep._pdbshown = True
return rep
def _postmortem_traceback(excinfo): def _postmortem_traceback(excinfo):