From 1b0d6296dd29edec92fad7f7031e487683d9c878 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Tue, 12 Jan 2010 16:08:48 +0100 Subject: [PATCH] test and fix looponfailing wrt to a bug introduced with the cmdline/session startup cleanup. --HG-- branch : trunk --- py/impl/test/looponfail/remote.py | 4 ++-- testing/pytest/looponfail/test_remote.py | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/py/impl/test/looponfail/remote.py b/py/impl/test/looponfail/remote.py index 3edc8fc79..da47d19d8 100644 --- a/py/impl/test/looponfail/remote.py +++ b/py/impl/test/looponfail/remote.py @@ -22,9 +22,9 @@ class LooponfailingSession(Session): self.remotecontrol = RemoteControl(self.config) self.out = py.io.TerminalWriter() - def main(self, initialitems=None): + def main(self, initialitems): try: - self.loopstate = loopstate = LoopState(initialitems) + self.loopstate = loopstate = LoopState([]) self.remotecontrol.setup() while 1: self.loop_once(loopstate) diff --git a/testing/pytest/looponfail/test_remote.py b/testing/pytest/looponfail/test_remote.py index 121d45d41..fb7cec236 100644 --- a/testing/pytest/looponfail/test_remote.py +++ b/testing/pytest/looponfail/test_remote.py @@ -127,3 +127,25 @@ class TestLooponFailing: session.loop_once(loopstate) assert len(loopstate.colitems) == 1 + + + def test_looponfail_functional_fail_to_ok(self, testdir): + p = testdir.makepyfile(""" + def test_one(): + x = 0 + assert x == 1 + """) + child = testdir.spawn_pytest("-f %s" % p) + child.expect("def test_one") + child.expect("x == 1") + child.expect("1 failed") + child.expect("### LOOPONFAILING ####") + child.expect("waiting for changes") + p.write(py.code.Source(""" + def test_one(): + x = 1 + assert x == 1 + """)) + child.expect(".*1 passed.*") + child.kill(15) +