[pypy-svn] r16430 - pypy/dist/lib-python

hpk at codespeak.net hpk at codespeak.net
Wed Aug 24 21:10:51 CEST 2005


Author: hpk
Date: Wed Aug 24 21:10:51 2005
New Revision: 16430

Modified:
   pypy/dist/lib-python/conftest.py
Log:
(nik, hpk)

finally hack py.test -E to at least not silently swallow errors
from running testcase "methods" which really are testcase 
instances.  We probably should run the test methods on 
our own (including setUp() and tearDown() because then
we would have nicer tracebacks). 



Modified: pypy/dist/lib-python/conftest.py
==============================================================================
--- pypy/dist/lib-python/conftest.py	(original)
+++ pypy/dist/lib-python/conftest.py	Wed Aug 24 21:10:51 2005
@@ -131,7 +131,16 @@
         return namemethodlist, doctestlist 
 
     def run_testcase_method(method): 
-        method()
+        result = method.defaultTestResult() 
+        method.run(result)
+        if result.errors:
+            assert len(result.errors)
+            print result.errors[0][1]
+        if result.failures:
+            assert len(result.failures)
+            print result.failures[0][1]
+        if result.failures or result.errors:
+            return 1
 
     def set_argv(filename): 
         sys.argv[:] = ['python', filename]
@@ -261,7 +270,10 @@
         filename = str(self.fspath) 
         callex(space, set_argv, space, space.wrap(filename))
         #space.call_function(self.w_method)
-        callex(space, run_testcase_method, space, self.w_method) 
+        res = callex(space, run_testcase_method, space, self.w_method) 
+        if res:
+            raise AssertionError(
+        "testcase instance invociation raised errors, see stdoudt")
 
 # ________________________________________________________________________
 #



More information about the Pypy-commit mailing list