[py-svn] py-trunk commit 49ee318008dc: test and fix looponfailing wrt to a bug introduced with the cmdline/session startup cleanup.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Jan 12 16:10:40 CET 2010


# HG changeset patch -- Bitbucket.org
# Project py-trunk
# URL http://bitbucket.org/hpk42/py-trunk/overview/
# User holger krekel <holger at merlinux.eu>
# Date 1263308928 -3600
# Node ID 49ee318008dc38c48074039434c358cc9345c002
# Parent 0b97b846458c967fb211b41ca4bcf65daa890f4f
test and fix looponfailing wrt to a bug introduced with the cmdline/session startup cleanup.

--- 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)

--- 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)
+



More information about the pytest-commit mailing list