[pypy-svn] r53343 - pypy/dist/pypy/lib/app_test/ctypes

pedronis at codespeak.net pedronis at codespeak.net
Fri Apr 4 19:00:48 CEST 2008


Author: pedronis
Date: Fri Apr  4 19:00:47 2008
New Revision: 53343

Modified:
   pypy/dist/pypy/lib/app_test/ctypes/test_callbacks.py
   pypy/dist/pypy/lib/app_test/ctypes/test_funcptr.py
   pypy/dist/pypy/lib/app_test/ctypes/test_functions.py
   pypy/dist/pypy/lib/app_test/ctypes/test_guess_argtypes.py
   pypy/dist/pypy/lib/app_test/ctypes/test_init.py
   pypy/dist/pypy/lib/app_test/ctypes/test_parameters.py
   pypy/dist/pypy/lib/app_test/ctypes/test_simplesubclasses.py
   pypy/dist/pypy/lib/app_test/ctypes/test_stringptr.py
   pypy/dist/pypy/lib/app_test/ctypes/test_struct_fields.py
   pypy/dist/pypy/lib/app_test/ctypes/test_structures.py
   pypy/dist/pypy/lib/app_test/ctypes/test_values.py
Log:
reviewed tests and skips.

tried to make skip messages more clear and consistent.

in the test_stringptr.py case the tests were mostly passing, I modified them and put a skip test passed!... at the end of them

test_guess_argtypes needs fixing



Modified: pypy/dist/pypy/lib/app_test/ctypes/test_callbacks.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_callbacks.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_callbacks.py	Fri Apr  4 19:00:47 2008
@@ -89,7 +89,7 @@
 ##        self.check_type(c_char_p, "def")
 
     def test_unsupported_restype_1(self):
-        py.test.skip("WIP")
+        py.test.skip("we are less strict about callback return type sanity")
         # Only "fundamental" result types are supported for callback
         # functions, the type must have a non-NULL stgdict->setfunc.
         # POINTER(c_double), for example, is not supported.
@@ -137,7 +137,7 @@
 class TestMoreCallbacks(BaseCTypesTestChecker):
 
     def test_callback_with_struct_argument(self):
-        py.test.skip("WIP")
+        py.test.skip("callbacks with struct arguments not implemented yet")
         class RECT(Structure):
             _fields_ = [("left", c_int), ("top", c_int),
                         ("right", c_int), ("bottom", c_int)]

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_funcptr.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_funcptr.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_funcptr.py	Fri Apr  4 19:00:47 2008
@@ -42,7 +42,7 @@
         # The following no longer raises a TypeError - it is now
         # possible, as in C, to call cdecl functions with more parameters.
         #self.assertRaises(TypeError, c, 1, 2, 3)
-        py.test.skip("PyPy's CTypes doesn't implement this")
+        py.test.skip("cdecl funcptrs ignoring extra args is not implemented")
         assert c(1, 2, 3, 4, 5, 6) == 3
         if not WINFUNCTYPE is CFUNCTYPE and os.name != "ce":
             raises(TypeError, s, 1, 2, 3)

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_functions.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_functions.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_functions.py	Fri Apr  4 19:00:47 2008
@@ -393,7 +393,7 @@
         assert result == "bcd"
 
     def test_sf1651235(self):
-        py.test.skip("XXX parameter checking for callbacks should be stricter")
+        py.test.skip("we are less strict in checking callback parameters")
         # see http://www.python.org/sf/1651235
 
         proto = CFUNCTYPE(c_int, RECT, POINT)

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_guess_argtypes.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_guess_argtypes.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_guess_argtypes.py	Fri Apr  4 19:00:47 2008
@@ -1,9 +1,12 @@
 
 """ This test checks whether args wrapping behavior is correct
 """
+import py
 
 import sys
 
+py.test.skip("FIXME")
+
 from ctypes import *
 
 def test_wrap_args():

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_init.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_init.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_init.py	Fri Apr  4 19:00:47 2008
@@ -1,7 +1,7 @@
 import py
 from ctypes import *
 
-py.test.skip("XXX subclassing behavior and implementation details tests")
+py.test.skip("subclassing semantics and implementation details not implemented")
 
 class X(Structure):
     _fields_ = [("a", c_int),

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_parameters.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_parameters.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_parameters.py	Fri Apr  4 19:00:47 2008
@@ -22,7 +22,7 @@
 
 
     def test_subclasses(self):
-        py.test.skip("XXX subclassing problem")
+        py.test.skip("subclassing semantics not implemented")
         from ctypes import c_void_p, c_char_p
         # ctypes 0.9.5 and before did overwrite from_param in SimpleType_new
         class CVOIDP(c_void_p):
@@ -52,7 +52,7 @@
 
     # XXX Replace by c_char_p tests
     def test_cstrings(self):
-        py.test.skip("Implementation specific IMO")
+        py.test.skip("testing implementation internals")
         from ctypes import c_char_p, byref
 
         # c_char_p.from_param on a Python String packs the string
@@ -151,7 +151,7 @@
 ##        check_perf()
 
     def test_noctypes_argtype(self):
-        py.test.skip("We implement details differently")
+        py.test.skip("we implement details differently")
         from ctypes import CDLL, c_void_p, ArgumentError
         import conftest
         dll = CDLL(str(conftest.sofile))

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_simplesubclasses.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_simplesubclasses.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_simplesubclasses.py	Fri Apr  4 19:00:47 2008
@@ -26,7 +26,7 @@
 
 
     def test_int_callback(self):
-        py.test.skip("XXX subclassing not implemented")
+        py.test.skip("subclassing semantics and implementation details not implemented")
         args = []
         def func(arg):
             args.append(arg)
@@ -43,7 +43,7 @@
         assert type(args[-1]) == int
 
     def test_int_struct(self):
-        py.test.skip("XXX wrong behaviour")
+        py.test.skip("subclassing semantics and implementation details not implemented")
         class X(Structure):
             _fields_ = [("x", MyInt)]
 

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_stringptr.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_stringptr.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_stringptr.py	Fri Apr  4 19:00:47 2008
@@ -11,7 +11,6 @@
 class TestStringPtr(BaseCTypesTestChecker):
 
     def test__POINTER_c_char(self):
-        py.test.skip("uses getrefcount")
         class X(Structure):
             _fields_ = [("str", POINTER(c_char))]
         x = X()
@@ -19,20 +18,22 @@
         # NULL pointer access
         raises(ValueError, getattr, x.str, "contents")
         b = c_buffer("Hello, World")
-        from sys import getrefcount as grc
-        assert grc(b) == 2
+        #from sys import getrefcount as grc
+        #assert grc(b) == 2
         x.str = b
-        assert grc(b) == 3
+        #assert grc(b) == 3
 
         # POINTER(c_char) and Python string is NOT compatible
         # POINTER(c_char) and c_buffer() is compatible
         for i in range(len(b)):
             assert b[i] == x.str[i]
 
-        raises(TypeError, setattr, x, "str", "Hello, World")
+        # XXX pypy  modified:
+        #raises(TypeError, setattr, x, "str", "Hello, World")
+        x = b = None
+        py.test.skip("test passes! but modified to avoid getrefcount and detail issues")
 
     def test__c_char_p(self):
-        py.test.skip("XXX not implemented")
         class X(Structure):
             _fields_ = [("str", c_char_p)]
         x = X()
@@ -42,8 +43,11 @@
         assert x.str == None
         x.str = "Hello, World"
         assert x.str == "Hello, World"
-        b = c_buffer("Hello, World")
-        raises(TypeError, setattr, x, "str", b)
+        # XXX pypy  modified:
+        #b = c_buffer("Hello, World")
+        #raises(TypeError, setattr, x, "str", b)
+        x = None
+        py.test.skip("test passes! but modified to avoid detail issues")
 
 
     def test_functions(self):

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_struct_fields.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_struct_fields.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_struct_fields.py	Fri Apr  4 19:00:47 2008
@@ -26,14 +26,14 @@
         raises(AttributeError, setattr, X, "_fields_", [])
 
     def test_2(self):
-        py.test.skip("no _fields_ unsupported")
+        py.test.skip("absent _fields_ semantics not implemented")
         class X(Structure):
             pass
         X()
         raises(AttributeError, setattr, X, "_fields_", [])
 
     def test_3(self):
-        py.test.skip("fails: no _fields_ and subclassing")
+        py.test.skip("subclassing semantics not implemented")
         class X(Structure):
             pass
         class Y(Structure):
@@ -41,7 +41,7 @@
         raises(AttributeError, setattr, X, "_fields_", [])
 
     def test_4(self):
-        py.test.skip("fails: no _fields_ and subclassing")
+        py.test.skip("subclassing semantics not implemented")
         class X(Structure):
             pass
         class Y(X):

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_structures.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_structures.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_structures.py	Fri Apr  4 19:00:47 2008
@@ -161,7 +161,7 @@
         # offset is always relative to the class...
 
     def test_packed(self):
-        py.test.skip("Custom alignment not supported")
+        py.test.skip("custom alignment not supported")
         class X(Structure):
             _fields_ = [("a", c_byte),
                         ("b", c_longlong)]
@@ -284,7 +284,7 @@
         raises(ValueError, PersonW, u"1234567890123")
 
     def test_init_errors(self):
-        py.test.skip("Very fragile errors")
+        py.test.skip("not implemented error details")
         class Phone(Structure):
             _fields_ = [("areacode", c_char*6),
                         ("number", c_char*12)]
@@ -332,7 +332,7 @@
 ##                             (AttributeError, "class must define a '_fields_' attribute"))
 
     def test_abstract_class(self):
-        py.test.skip("_abstract_ not implemented")
+        py.test.skip("_abstract_ semantics not implemented")
         class X(Structure):
             _abstract_ = "something"
         # try 'X()'
@@ -358,7 +358,7 @@
         assert p.age == 6
 
     def test_subclassing_field_is_a_tuple(self):
-        py.test.skip("suclassing not supported")
+        py.test.skip("subclassing semantics not implemented")
         class Person(Structure):
             _fields_ = (("name", c_char*6),
                         ("age", c_int))
@@ -429,7 +429,7 @@
 
 
     def test_vice_versa(self):
-        py.test.skip("XXX mutually dependent lazily defined structures")
+        py.test.skip("mutually dependent lazily defined structures error semantics")
         class First(Structure):
             pass
         class Second(Structure):

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_values.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_values.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_values.py	Fri Apr  4 19:00:47 2008
@@ -26,7 +26,7 @@
 class TestWin_Values(BaseCTypesTestChecker):
     """This test only works when python itself is a dll/shared library"""
     def setup_class(cls):
-        py.test.skip("only when cpython itself is a dll")
+        py.test.skip("tests expect and access cpython dll")
 
     def test_optimizeflag(self):
         # This test accesses the Py_OptimizeFlag intger, which is



More information about the Pypy-commit mailing list