[pypy-commit] pypy default: Remove this lone small test file and merge it into test_lib_pypy.

arigo noreply at buildbot.pypy.org
Thu Oct 18 08:32:50 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r58190:acb6eb26ce8f
Date: 2012-10-18 08:24 +0200
http://bitbucket.org/pypy/pypy/changeset/acb6eb26ce8f/

Log:	Remove this lone small test file and merge it into test_lib_pypy.

diff --git a/lib_pypy/pypy_test/test_ctypes_support.py b/lib_pypy/pypy_test/test_ctypes_support.py
deleted file mode 100644
--- a/lib_pypy/pypy_test/test_ctypes_support.py
+++ /dev/null
@@ -1,32 +0,0 @@
-from __future__ import absolute_import
-
-import py
-from ctypes import *
-try:
-    from ctypes_support import standard_c_lib, get_errno, set_errno
-except ImportError:    # on top of cpython
-    from lib_pypy.ctypes_support import standard_c_lib, get_errno, set_errno
-
-
-def test_stdlib_and_errno():
-    py.test.skip("this is expected on top of pypy, we need to fix ctypes in a way that is now in 2.6 in order to make this reliable")
-    write = standard_c_lib.write
-    write.argtypes = [c_int, c_char_p, c_size_t]
-    write.restype = c_size_t
-    # clear errno first
-    set_errno(0)
-    assert get_errno() == 0
-    write(-345, "abc", 3)
-    assert get_errno() != 0
-    set_errno(0)
-    assert get_errno() == 0
-
-def test_argument_conversion_and_checks():
-    strlen = standard_c_lib.strlen
-    strlen.argtypes = [c_char_p]
-    strlen.restype = c_size_t
-    assert strlen("eggs") == 4
-
-    # Should raise ArgumentError, not segfault
-    py.test.raises(ArgumentError, strlen, False)
-
diff --git a/pypy/module/test_lib_pypy/ctypes_tests/test_functions.py b/pypy/module/test_lib_pypy/ctypes_tests/test_functions.py
--- a/pypy/module/test_lib_pypy/ctypes_tests/test_functions.py
+++ b/pypy/module/test_lib_pypy/ctypes_tests/test_functions.py
@@ -462,6 +462,15 @@
         callback = proto(callback)
         raises(ArgumentError, lambda: callback((1, 2, 3, 4), POINT()))
 
+    def test_argument_conversion_and_checks(self):
+        strlen = dll.my_strchr
+        strlen.argtypes = [c_char_p, c_int]
+        strlen.restype = c_char_p
+        assert strlen("eggs", ord("g")) == "ggs"
+
+        # Should raise ArgumentError, not segfault
+        py.test.raises(ArgumentError, strlen, False, 0)
+
     def test_union_as_passed_value(self):
         class UN(Union):
             _fields_ = [("x", c_short),
@@ -545,3 +554,5 @@
         res = test_errno()
         n = get_errno()
         assert (res, n) == (42, 43)
+        set_errno(0)
+        assert get_errno() == 0


More information about the pypy-commit mailing list