[pypy-commit] pypy ffi-backend: Merge test_c from hg/cffi/c.
arigo
noreply at buildbot.pypy.org
Thu Jul 26 12:44:56 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: ffi-backend
Changeset: r56467:56191fd46a3c
Date: 2012-07-26 12:44 +0200
http://bitbucket.org/pypy/pypy/changeset/56191fd46a3c/
Log: Merge test_c from hg/cffi/c.
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -1569,10 +1569,15 @@
assert get_errno() == 65
f(); f()
assert get_errno() == 95
- #
+
+def test_errno_callback():
+ if globals().get('PY_DOT_PY') == '2.5':
+ py.test.skip("cannot run this test on py.py with Python 2.5")
def cb():
e = get_errno()
set_errno(e - 6)
+ BVoid = new_void_type()
+ BFunc5 = new_function_type((), BVoid)
f = callback(BFunc5, cb)
f()
assert get_errno() == 89
diff --git a/pypy/module/_cffi_backend/test/test_c.py b/pypy/module/_cffi_backend/test/test_c.py
--- a/pypy/module/_cffi_backend/test/test_c.py
+++ b/pypy/module/_cffi_backend/test/test_c.py
@@ -3,7 +3,7 @@
This file is OBSCURE. Really. The purpose is to avoid copying and changing
'test_c.py' from cffi/c/.
"""
-import py, ctypes
+import py, sys, ctypes
from pypy.tool.udir import udir
from pypy.conftest import gettestobjspace
from pypy.interpreter import gateway
@@ -45,12 +45,13 @@
w_func = space.wrap(gateway.interp2app(find_and_load_library_for_test))
w_testfunc = space.wrap(gateway.interp2app(testfunc_for_test))
- space.appexec([space.wrap(str(tmpdir)), w_func, w_testfunc],
- """(path, func, testfunc):
+ space.appexec([space.wrap(str(tmpdir)), w_func, w_testfunc,
+ space.wrap(sys.version[:3])],
+ """(path, func, testfunc, underlying_version):
import sys
sys.path.append(path)
import _all_test_c
- _all_test_c.PY_DOT_PY = True
+ _all_test_c.PY_DOT_PY = underlying_version
_all_test_c.find_and_load_library = func
_all_test_c._testfunc = testfunc
""")
More information about the pypy-commit
mailing list