[svn r58699] show traceback before jumping into pdb

--HG--
branch : trunk
This commit is contained in:
hpk 2008-10-07 11:26:56 +02:00
parent 1bd4afee0b
commit c338420976
2 changed files with 9 additions and 5 deletions

View File

@ -72,11 +72,14 @@ class ItemRunner(RobustRun):
def makereport(self, res, when, excinfo, outerr): def makereport(self, res, when, excinfo, outerr):
if excinfo: if excinfo:
kw = self.getkw(when, excinfo, outerr) kw = self.getkw(when, excinfo, outerr)
if self.pdb and kw.get('failed', 0):
self.pdb(excinfo)
else: else:
kw = {'passed': OutcomeRepr(when, '.', "")} kw = {'passed': OutcomeRepr(when, '.', "")}
return event.ItemTestReport(self.colitem, **kw) testrep = event.ItemTestReport(self.colitem, **kw)
if self.pdb and testrep.failed:
tw = py.io.TerminalWriter()
testrep.toterminal(tw)
self.pdb(excinfo)
return testrep
class CollectorRunner(RobustRun): class CollectorRunner(RobustRun):
def setup(self): def setup(self):

View File

@ -403,15 +403,16 @@ class TestInteractive(AcceptBase):
spawn = self.getspawn() spawn = self.getspawn()
self.makepyfile(test_one=""" self.makepyfile(test_one="""
def test_1(): def test_1():
#hello
assert 1 == 0 assert 1 == 0
""") """)
child = spawn("%s %s --pdb test_one.py" % (py.std.sys.executable, child = spawn("%s %s --pdb test_one.py" % (py.std.sys.executable,
pytestpath)) pytestpath))
child.timeout = EXPECTTIMEOUT child.timeout = EXPECTTIMEOUT
child.expect("(Pdb)")
child.sendline("l")
child.expect(".*def test_1.*") child.expect(".*def test_1.*")
child.expect(".*hello.*")
child.expect("(Pdb)")
child.sendeof() child.sendeof()
child.expect("failures: 1") child.expect("failures: 1")
if child.isalive(): if child.isalive():