move pdb plugin post morten traceback selection to a own function
this is preparation for making it resillent against broken envs that can't import doctest
This commit is contained in:
parent
94aa76fec0
commit
63a6936d82
|
@ -70,16 +70,21 @@ class PdbInvoke:
|
||||||
tw.sep(">", "traceback")
|
tw.sep(">", "traceback")
|
||||||
rep.toterminal(tw)
|
rep.toterminal(tw)
|
||||||
tw.sep(">", "entering PDB")
|
tw.sep(">", "entering PDB")
|
||||||
# A doctest.UnexpectedException is not useful for post_mortem.
|
|
||||||
# Use the underlying exception instead:
|
tb = self._postmortem_traceback(call.excinfo)
|
||||||
if isinstance(call.excinfo.value, py.std.doctest.UnexpectedException):
|
|
||||||
tb = call.excinfo.value.exc_info[2]
|
|
||||||
else:
|
|
||||||
tb = call.excinfo._excinfo[2]
|
|
||||||
post_mortem(tb)
|
post_mortem(tb)
|
||||||
rep._pdbshown = True
|
rep._pdbshown = True
|
||||||
return rep
|
return rep
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _postmortem_traceback(excinfo):
|
||||||
|
# A doctest.UnexpectedException is not useful for post_mortem.
|
||||||
|
# Use the underlying exception instead:
|
||||||
|
if isinstance(excinfo.value, py.std.doctest.UnexpectedException):
|
||||||
|
return excinfo.value.exc_info[2]
|
||||||
|
else:
|
||||||
|
return excinfo._excinfo[2]
|
||||||
|
|
||||||
def post_mortem(t):
|
def post_mortem(t):
|
||||||
pdb = py.std.pdb
|
pdb = py.std.pdb
|
||||||
class Pdb(pdb.Pdb):
|
class Pdb(pdb.Pdb):
|
||||||
|
|
Loading…
Reference in New Issue