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

hpk at codespeak.net hpk at codespeak.net
Tue Aug 12 21:07:11 CEST 2008


Author: hpk
Date: Tue Aug 12 21:07:08 2008
New Revision: 57213

Modified:
   py/branch/event/py/test2/testing/acceptance_test.py
Log:
add a skipped acceptance test for --looponfailing 


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	Tue Aug 12 21:07:08 2008
@@ -14,7 +14,7 @@
         self.outlines = outlines
         self.errlines = errlines
 
-class TestPyTest(FileCreation):
+class AcceptBase(FileCreation):
     def runpytest(self, *args):
         pytestcmd = py.path.local(py.__file__).dirpath("bin", "py.test2")
         cmdargs = [py.std.sys.executable, pytestcmd] + list(args)
@@ -32,12 +32,13 @@
         return Result(ret, out, err)
 
     def setup_method(self, method):
-        super(TestPyTest, self).setup_method(method)
+        super(AcceptBase, self).setup_method(method)
         self.old = self.tmpdir.chdir()
 
     def teardown_method(self, method):
         self.old.chdir()
 
+class TestPyTest(AcceptBase):
     def test_assertion_magic(self):
         p = self.makepyfile(test_one="""
             def test_this():
@@ -323,13 +324,14 @@
             "*0/1 passed*",
         ])
 
+class TestInteractive(AcceptBase):
     def getspawn(self):
         try:
             import pexpect
         except ImportError:
             py.test.skip("need pexpect")
         return pexpect.spawn 
-        
+       
     def test_pdb_interaction(self):
         spawn = self.getspawn()
         self.makepyfile(test_one="""
@@ -346,3 +348,26 @@
         child.expect("failures: 1", timeout=EXPECTTIMEOUT)
         child.wait()
 
+
+    def test_simple_looponfailing_interaction(self):
+        spawn = self.getspawn()
+        test_one = self.makepyfile(test_one="""
+            def test_1():
+                assert 1 == 0 
+        """)
+       
+        child = spawn("%s %s --looponfailing test_one.py" % (py.std.sys.executable, 
+                      str(pytestpath)[:-1]))
+        child.timeout = EXPECTTIMEOUT
+        child.expect("assert 1 == 0")
+        child.expect("test_one.py:")
+        child.expect("failures: 1")
+        
+        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()
+ 



More information about the pytest-commit mailing list