[pypy-commit] pypy jitypes2: fix the tests

antocuni noreply at buildbot.pypy.org
Mon May 23 12:18:08 CEST 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: jitypes2
Changeset: r44380:92925fae6600
Date: 2011-05-23 12:25 +0200
http://bitbucket.org/pypy/pypy/changeset/92925fae6600/

Log:	fix the tests

diff --git a/lib_pypy/_ctypes/function.py b/lib_pypy/_ctypes/function.py
--- a/lib_pypy/_ctypes/function.py
+++ b/lib_pypy/_ctypes/function.py
@@ -653,17 +653,17 @@
         def _setcallable(self, func):
             self.__rollback()
             self.callable = func
-        callable = property(lambda: None, _setcallable)
+        callable = property(lambda x: None, _setcallable)
 
         def _setcom_index(self, idx):
             self.__rollback()
             self._com_index = idx
-        _com_index = property(lambda: None, _setcom_index)
+        _com_index = property(lambda x: None, _setcom_index)
 
         def _seterrcheck(self, func):
             self.__rollback()
             self.errcheck = func
-        errcheck = property(lambda: None, _seterrcheck)
+        errcheck = property(lambda x: None, _seterrcheck)
 
         def __call__(self, *args):
             thisarg = None
@@ -675,7 +675,6 @@
             except TypeError: # XXX, should be FFITypeError
                 assert self._slowpath_allowed
                 return CFuncPtr.__call__(self, *args)
-            assert self._errcheck_ is None
             return result
 
     make_specialized_subclass.memo[CFuncPtr] = CFuncPtrFast
diff --git a/pypy/module/test_lib_pypy/ctypes_tests/test_fastpath.py b/pypy/module/test_lib_pypy/ctypes_tests/test_fastpath.py
--- a/pypy/module/test_lib_pypy/ctypes_tests/test_fastpath.py
+++ b/pypy/module/test_lib_pypy/ctypes_tests/test_fastpath.py
@@ -25,11 +25,12 @@
         tf_b = dll.tf_b
         tf_b.restype = c_byte
         tf_b.argtypes = (c_byte,)
-        tf_b.errcheck = errcheck # errcheck disables the fastpath
+        # errcheck disables the fastpath
+        py.test.raises(AssertionError, "tf_b.errcheck = errcheck")
+        #
         assert tf_b._is_fastpath
         assert not tf_b._slowpath_allowed
-        py.test.raises(AssertionError, "tf_b(-126)")
-        del tf_b.errcheck
+        py.test.raises(AssertionError, "tf_b('aaa')") # force a TypeError
 
     def test_simple_args(self):
         tf_b = dll.tf_b


More information about the pypy-commit mailing list