diff --git a/py/test/runner.py b/py/test/runner.py index 25f0f8483..b30805495 100644 --- a/py/test/runner.py +++ b/py/test/runner.py @@ -72,11 +72,14 @@ class ItemRunner(RobustRun): def makereport(self, res, when, excinfo, outerr): if excinfo: kw = self.getkw(when, excinfo, outerr) - if self.pdb and kw.get('failed', 0): - self.pdb(excinfo) else: 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): def setup(self): diff --git a/py/test/testing/acceptance_test.py b/py/test/testing/acceptance_test.py index e3fdec714..3d234712a 100644 --- a/py/test/testing/acceptance_test.py +++ b/py/test/testing/acceptance_test.py @@ -403,15 +403,16 @@ class TestInteractive(AcceptBase): spawn = self.getspawn() self.makepyfile(test_one=""" def test_1(): + #hello assert 1 == 0 """) child = spawn("%s %s --pdb test_one.py" % (py.std.sys.executable, pytestpath)) child.timeout = EXPECTTIMEOUT - child.expect("(Pdb)") - child.sendline("l") child.expect(".*def test_1.*") + child.expect(".*hello.*") + child.expect("(Pdb)") child.sendeof() child.expect("failures: 1") if child.isalive():