[pypy-svn] r51433 - pypy/dist/pypy/lib/app_test/ctypes
fijal at codespeak.net
fijal at codespeak.net
Wed Feb 13 13:39:03 CET 2008
Author: fijal
Date: Wed Feb 13 13:39:02 2008
New Revision: 51433
Modified:
pypy/dist/pypy/lib/app_test/ctypes/test_numbers.py
Log:
Check reference leaks.
Modified: pypy/dist/pypy/lib/app_test/ctypes/test_numbers.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_numbers.py (original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_numbers.py Wed Feb 13 13:39:02 2008
@@ -41,6 +41,25 @@
################################################################
class TestNumber:
+ def setup_class(cls):
+ try:
+ import _rawffi
+ except ImportError:
+ pass
+ else:
+ cls.old_num = _rawffi._num_of_allocated_objects()
+
+ def teardown_class(cls):
+ try:
+ import _rawffi
+ except ImportError:
+ pass
+ else:
+ import gc
+ gc.collect()
+ # there is one reference coming from the byref() above
+ assert _rawffi._num_of_allocated_objects() <= cls.old_num
+
def test_default_init(self):
# default values are set to zero
for t in signed_types + unsigned_types + float_types:
@@ -175,7 +194,7 @@
## def test_perf(self):
## check_perf()
-from ctypes import _SimpleCData
-class c_int_S(_SimpleCData):
- _type_ = "i"
- __slots__ = []
+#from ctypes import _SimpleCData
+#class c_int_S(_SimpleCData):
+# _type_ = "i"
+# __slots__ = []
More information about the Pypy-commit
mailing list