[py-svn] r56723 - in py/branch/event/py/test2: . testing

hpk at codespeak.net hpk at codespeak.net
Tue Jul 22 22:00:55 CEST 2008


Author: hpk
Date: Tue Jul 22 22:00:54 2008
New Revision: 56723

Modified:
   py/branch/event/py/test2/runner.py
   py/branch/event/py/test2/testing/test_runner.py
Log:
SystemExit exceptions should not end the testing process.


Modified: py/branch/event/py/test2/runner.py
==============================================================================
--- py/branch/event/py/test2/runner.py	(original)
+++ py/branch/event/py/test2/runner.py	Tue Jul 22 22:00:54 2008
@@ -32,7 +32,7 @@
             outcome = "passed"
         finally:
             outerr = capture.reset()
-    except py.builtin.sysex: 
+    except KeyboardInterrupt:
         raise
     except: 
         excinfo = py.code.ExceptionInfo()

Modified: py/branch/event/py/test2/testing/test_runner.py
==============================================================================
--- py/branch/event/py/test2/testing/test_runner.py	(original)
+++ py/branch/event/py/test2/testing/test_runner.py	Tue Jul 22 22:00:54 2008
@@ -63,6 +63,16 @@
         assert not testrep.failed
         assert not testrep.setupfailed
 
+    def test_systemexit_does_not_bail_out(self):
+        testrep = self.runtestfunc("""
+            import sys
+            def testfunc():
+                raise SystemExit(42)
+        """)
+        assert testrep.failed
+        assert not testrep.setupfailed
+        assert testrep.repr_run.find("SystemExit") != -1
+
     def test_run_capture_stdout(self):
         testrep = self.runtestfunc("""
             def testfunc():



More information about the pytest-commit mailing list