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

fijal at codespeak.net fijal at codespeak.net
Mon Feb 18 17:43:00 CET 2008


Author: fijal
Date: Mon Feb 18 17:42:58 2008
New Revision: 51596

Modified:
   pypy/dist/pypy/lib/app_test/ctypes/support.py
   pypy/dist/pypy/lib/app_test/ctypes/test_anon.py
   pypy/dist/pypy/lib/app_test/ctypes/test_array_in_pointer.py
Log:
it seems that for generation gc the magic number is 4 here.
two more tracing tests.


Modified: pypy/dist/pypy/lib/app_test/ctypes/support.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/support.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/support.py	Mon Feb 18 17:42:58 2008
@@ -18,7 +18,7 @@
             pass
         else:
             import gc
-            for _ in range(3):
+            for _ in range(4):
                 gc.collect()
             # there is one reference coming from the byref() above
-            assert _rawffi._num_of_allocated_objects() == cls.old_num
+            assert _rawffi._num_of_allocated_objects() <= cls.old_num

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_anon.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_anon.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_anon.py	Mon Feb 18 17:42:58 2008
@@ -1,6 +1,7 @@
 from ctypes import *
+from support import BaseCTypesTestChecker
 
-class TestAnon:
+class TestAnon(BaseCTypesTestChecker):
 
     def test_anon(self):
         class ANON(Union):

Modified: pypy/dist/pypy/lib/app_test/ctypes/test_array_in_pointer.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_array_in_pointer.py	(original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_array_in_pointer.py	Mon Feb 18 17:42:58 2008
@@ -2,6 +2,7 @@
 from binascii import hexlify
 import re
 import py
+from support import BaseCTypesTestChecker
 
 def dump(obj):
     # helper function to dump memory contents in hex, with a hyphen
@@ -23,8 +24,9 @@
 class Container(Structure):
     _fields_ = [("pvalues", POINTER(Value))]
 
-class TestOne:
+class TestOne(BaseCTypesTestChecker):
     def test(self):
+        from _rawffi import _num_of_allocated_objects as _num
         # create an array of 4 values
         val_array = (Value * 4)()
 



More information about the Pypy-commit mailing list