[py-svn] r57248 - py/branch/event/py/test2/testing

hpk at codespeak.net hpk at codespeak.net
Thu Aug 14 16:00:18 CEST 2008


Author: hpk
Date: Thu Aug 14 16:00:15 2008
New Revision: 57248

Modified:
   py/branch/event/py/test2/testing/acceptance_test.py
Log:
add (passing) looponfailing acceptance test


Modified: py/branch/event/py/test2/testing/acceptance_test.py
==============================================================================
--- py/branch/event/py/test2/testing/acceptance_test.py	(original)
+++ py/branch/event/py/test2/testing/acceptance_test.py	Thu Aug 14 16:00:15 2008
@@ -352,7 +352,9 @@
             import pexpect
         except ImportError:
             py.test.skip("need pexpect")
-        return pexpect.spawn 
+        def spawn(cmd):
+            return pexpect.spawn(cmd, logfile=self.tmpdir.join("spawn.out").open("w"))
+        return spawn
        
     def test_pdb_interaction(self):
         spawn = self.getspawn()
@@ -372,7 +374,6 @@
 
 
     def test_simple_looponfailing_interaction(self):
-        py.test.skip("implement --looponfailing")
         spawn = self.getspawn()
         test_one = self.makepyfile(test_one="""
             def test_1():
@@ -380,17 +381,21 @@
         """)
        
         child = spawn("%s %s --looponfailing test_one.py" % (py.std.sys.executable, 
-                      str(pytestpath)[:-1]))
+                      str(pytestpath)))
         child.timeout = EXPECTTIMEOUT
         child.expect("assert 1 == 0")
         child.expect("test_one.py:")
         child.expect("failures: 1")
+
+        child.expect("waiting for changes")
         
         test_one.write(py.code.Source("""
             def test_1():
                 assert 1 == 1
         """))
-        child.expect("file change detected", timeout=2.0) 
-        child.expect("failures: no failures :)")
-        child.kill()
+        pyc = test_one + "c"
+        if pyc.check(): pyc.remove() # XXX 
+        child.expect("MODIFIED.*test_one.py", timeout=4.0)
+        child.expect("failures: no failures", timeout=5.0)
+        child.kill(15)
  



More information about the pytest-commit mailing list