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

fijal at codespeak.net fijal at codespeak.net
Mon Feb 18 22:01:27 CET 2008


Author: fijal
Date: Mon Feb 18 22:01:24 2008
New Revision: 51612

Modified:
   pypy/dist/pypy/lib/app_test/ctypes/test_keepalive.py
   pypy/dist/pypy/lib/app_test/ctypes/test_memfunctions.py
   pypy/dist/pypy/lib/app_test/ctypes/test_pointers.py
   pypy/dist/pypy/lib/app_test/ctypes/test_sizes.py
   pypy/dist/pypy/lib/app_test/ctypes/test_structures.py
   pypy/dist/pypy/lib/app_test/ctypes/test_unicode.py
Log:
These tests are passing out of the box. This likely means that we don't have
enough coverage


Modified: pypy/dist/pypy/lib/app_test/ctypes/test_keepalive.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_keepalive.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_keepalive.py	Mon Feb 18 22:01:24 2008
@@ -39,7 +39,7 @@
         assert p._objects['1'].value == 3
 
     def test_primitive(self):
-        assert c_char_p("abc")._objects == "abc"
+        assert c_char_p("abc")._objects['0']._buffer[0] == "a"
         assert c_int(3)._objects is None
 
     def test_pointer_to_pointer(self):

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_memfunctions.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_memfunctions.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_memfunctions.py	Mon Feb 18 22:01:24 2008
@@ -2,8 +2,9 @@
 import py
 import sys
 from ctypes import *
+from support import BaseCTypesTestChecker
 
-class TestMemFunctions:
+class TestMemFunctions(BaseCTypesTestChecker):
     def test_memmove(self):
         # large buffers apparently increase the chance that the memory
         # is allocated in high address space.

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_pointers.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_pointers.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_pointers.py	Mon Feb 18 22:01:24 2008
@@ -11,7 +11,7 @@
     import conftest
     mod._ctypes_test = str(conftest.sofile)
 
-class TestPointers:
+class TestPointers(BaseCTypesTestChecker):
     def test_pointer_crash(self):
 
         class A(POINTER(c_ulong)):

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_sizes.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_sizes.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_sizes.py	Mon Feb 18 22:01:24 2008
@@ -1,8 +1,9 @@
 # Test specifically-sized containers.
 
 from ctypes import *
+from support import BaseCTypesTestChecker
 
-class TestSizes:
+class TestSizes(BaseCTypesTestChecker):
     def test_8(self):
         assert 1 == sizeof(c_int8)
         assert 1 == sizeof(c_uint8)

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	Mon Feb 18 22:01:24 2008
@@ -349,7 +349,7 @@
         assert "from_address" in dir(type(Structure))
         assert "in_dll" in dir(type(Structure))
 
-class TestPointerMember:#(BaseCTypesTestChecker):
+class TestPointerMember(BaseCTypesTestChecker):
 
     def test_1(self):
         # a Structure with a POINTER field

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_unicode.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_unicode.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_unicode.py	Mon Feb 18 22:01:24 2008
@@ -1,6 +1,7 @@
 # coding: latin-1
 import ctypes
 import py
+from support import BaseCTypesTestChecker
 
 try:
     ctypes.c_wchar
@@ -14,7 +15,7 @@
         mod.wcslen.argtypes = [ctypes.c_wchar_p]
         mod.func = dll._testfunc_p_p
 
-    class TestUnicode:
+    class TestUnicode(BaseCTypesTestChecker):
         def setup_method(self, method):
             self.prev_conv_mode = ctypes.set_conversion_mode("ascii", "strict")
 
@@ -109,5 +110,3 @@
             # is that correct? not sure.  But with 'ignore', you get what you pay for..
             assert buf[:] == "ab\0\0\0\0"
 
-if __name__ == '__main__':
-    unittest.main()



More information about the Pypy-commit mailing list