fix a pdb problem when dropping to a "raises" related failure
--HG-- branch : trunk
This commit is contained in:
parent
3bca6be46d
commit
c7326f1949
|
@ -29,6 +29,8 @@ Changes between 1.2.1 and 1.2.0
|
||||||
|
|
||||||
- fix issue63: assume <40 columns to be a bogus terminal width, default to 80
|
- fix issue63: assume <40 columns to be a bogus terminal width, default to 80
|
||||||
|
|
||||||
|
- fix pdb debugging to be in the correct frame on raises-related errors
|
||||||
|
|
||||||
- update apipkg.py to fix an issue where recursive imports might
|
- update apipkg.py to fix an issue where recursive imports might
|
||||||
unnecessarily break importing
|
unnecessarily break importing
|
||||||
|
|
||||||
|
|
|
@ -91,10 +91,11 @@ class Pdb(py.std.pdb.Pdb):
|
||||||
stack, i = pdb.Pdb.get_stack(self, f, t)
|
stack, i = pdb.Pdb.get_stack(self, f, t)
|
||||||
if f is None:
|
if f is None:
|
||||||
i = max(0, len(stack) - 1)
|
i = max(0, len(stack) - 1)
|
||||||
|
while i and stack[i][0].f_locals.get("__tracebackhide__", False):
|
||||||
|
i-=1
|
||||||
return stack, i
|
return stack, i
|
||||||
|
|
||||||
def post_mortem(t):
|
def post_mortem(t):
|
||||||
# modified from pdb.py for the new get_stack() implementation
|
|
||||||
p = Pdb()
|
p = Pdb()
|
||||||
p.reset()
|
p.reset()
|
||||||
p.interaction(None, t)
|
p.interaction(None, t)
|
||||||
|
|
|
@ -43,3 +43,22 @@ class TestPDB:
|
||||||
child.expect("1 failed")
|
child.expect("1 failed")
|
||||||
if child.isalive():
|
if child.isalive():
|
||||||
child.wait()
|
child.wait()
|
||||||
|
|
||||||
|
def test_pdb_interaction_exception(self, testdir):
|
||||||
|
p1 = testdir.makepyfile("""
|
||||||
|
import py
|
||||||
|
def globalfunc():
|
||||||
|
pass
|
||||||
|
def test_1():
|
||||||
|
py.test.raises(ValueError, globalfunc)
|
||||||
|
""")
|
||||||
|
child = testdir.spawn_pytest("--pdb %s" % p1)
|
||||||
|
child.expect(".*def test_1")
|
||||||
|
child.expect(".*py.test.raises.*globalfunc")
|
||||||
|
child.expect("(Pdb)")
|
||||||
|
child.sendline("globalfunc")
|
||||||
|
child.expect(".*function")
|
||||||
|
child.sendeof()
|
||||||
|
child.expect("1 failed")
|
||||||
|
if child.isalive():
|
||||||
|
child.wait()
|
||||||
|
|
Loading…
Reference in New Issue