[pypy-svn] r74373 - pypy/branch/py12/pypy/lib/app_test/ctypes_tests

hpk at codespeak.net hpk at codespeak.net
Wed May 5 10:11:54 CEST 2010


Author: hpk
Date: Wed May  5 10:11:53 2010
New Revision: 74373

Modified:
   pypy/branch/py12/pypy/lib/app_test/ctypes_tests/support.py
Log:
simplifying and fixing applevel skipping


Modified: pypy/branch/py12/pypy/lib/app_test/ctypes_tests/support.py
==============================================================================
--- pypy/branch/py12/pypy/lib/app_test/ctypes_tests/support.py	(original)
+++ pypy/branch/py12/pypy/lib/app_test/ctypes_tests/support.py	Wed May  5 10:11:53 2010
@@ -1,36 +1,29 @@
 import py
 import ctypes
 
-if ctypes.__version__ < "1.0.2":
-    py.test.skip("we expect a ctypes implementation with ver >= 1.0.2")
+py.test.importorskip("ctypes", "1.0.2")
+
+try:
+    import _rawffi
+except ImportError:
+    _rawffi = None
 
 class WhiteBoxTests:
 
     def setup_class(cls):
-        try:
-            import _rawffi
-        except ImportError:
-            py.test.skip("these tests are white-box tests for pypy _rawffi based ctypes impl")
+        if _rawffi:
+            py.test.skip("white-box tests for pypy _rawffi based ctypes impl")
 
 class BaseCTypesTestChecker:
     def setup_class(cls):
-        try:
-            import _rawffi
-        except ImportError:
-            pass
-        else:
+        if _rawffi:
             import gc
             for _ in range(4):
                 gc.collect()
             cls.old_num = _rawffi._num_of_allocated_objects()
     
     def teardown_class(cls):
-        #return
-        try:
-            import _rawffi
-        except ImportError:
-            pass
-        else:
+        if hasattr(cls, 'old_num'):
             import gc
             for _ in range(4):
                 gc.collect()



More information about the Pypy-commit mailing list