[pypy-svn] r59561 - pypy/trunk/lib-python/modified-2.5.2/test

arigo at codespeak.net arigo at codespeak.net
Thu Oct 30 15:00:52 CET 2008


Author: arigo
Date: Thu Oct 30 15:00:51 2008
New Revision: 59561

Modified:
   pypy/trunk/lib-python/modified-2.5.2/test/list_tests.py
   pypy/trunk/lib-python/modified-2.5.2/test/test_descr.py
   pypy/trunk/lib-python/modified-2.5.2/test/test_file.py
   pypy/trunk/lib-python/modified-2.5.2/test/test_set.py
   pypy/trunk/lib-python/modified-2.5.2/test/test_support.py
   pypy/trunk/lib-python/modified-2.5.2/test/test_weakref.py
Log:
Add an argument to the test_support.impl_detail decorator
to specify the reason for which we consider it an implementation
detail.


Modified: pypy/trunk/lib-python/modified-2.5.2/test/list_tests.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/test/list_tests.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/test/list_tests.py	Thu Oct 30 15:00:51 2008
@@ -513,7 +513,7 @@
         a[::2] = tuple(range(5))
         self.assertEqual(a, self.type2test([0, 1, 1, 3, 2, 5, 3, 7, 4, 9]))
 
-    @test_support.impl_detail
+    @test_support.impl_detail("list() might call __len__() or not")
     def test_constructor_exception_handling(self):
         # Bug #1242657
         class F(object):

Modified: pypy/trunk/lib-python/modified-2.5.2/test/test_descr.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/test/test_descr.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/test/test_descr.py	Thu Oct 30 15:00:51 2008
@@ -4006,7 +4006,7 @@
         __metaclass__ = M
     veris(type(C.__dict__), type(B.__dict__))
 
- at impl_detail
+ at impl_detail("testing an internal kind of method object")
 def meth_class_get():
     # Full coverage of descrobject.c::classmethod_get()
     if verbose:

Modified: pypy/trunk/lib-python/modified-2.5.2/test/test_file.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/test/test_file.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/test/test_file.py	Thu Oct 30 15:00:51 2008
@@ -220,7 +220,7 @@
         finally:
             os.unlink(TESTFN)
 
-    @impl_detail
+    @impl_detail()
     def testIteration(self):
         # Test the complex interaction when mixing file-iteration and the
         # various read* methods. Ostensibly, the mixture could just be tested

Modified: pypy/trunk/lib-python/modified-2.5.2/test/test_set.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/test/test_set.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/test/test_set.py	Thu Oct 30 15:00:51 2008
@@ -278,7 +278,7 @@
             fo.close()
             os.remove(test_support.TESTFN)
 
-    @test_support.impl_detail
+    @test_support.impl_detail("depends on how many times __hash__ is called")
     def test_do_not_rehash_dict_keys(self):
         n = 10
         d = dict.fromkeys(map(HashCountingInt, xrange(n)))
@@ -515,7 +515,7 @@
         s.__init__(self.otherword)
         self.assertEqual(s, set(self.word))
 
-    @test_support.impl_detail
+    @test_support.impl_detail("checks an internal optimization")
     def test_singleton_empty_frozenset(self):
         f = frozenset()
         efs = [frozenset(), frozenset([]), frozenset(()), frozenset(''),
@@ -686,7 +686,7 @@
             self.assert_(v in self.values)
         setiter = iter(self.set)
 
-    @test_support.impl_detail
+    @test_support.impl_detail("__length_hint__ is internal and undocumented")
     def test__length_hint(self):
         # note: __length_hint__ is an internal undocumented API,
         # don't rely on it in your own programs

Modified: pypy/trunk/lib-python/modified-2.5.2/test/test_support.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/test/test_support.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/test/test_support.py	Thu Oct 30 15:00:51 2008
@@ -536,18 +536,21 @@
 check_impl_detail = (hasattr(sys, 'subversion') and
                      sys.subversion[0] == 'CPython')
 
-def impl_detail(f):
+def impl_detail(reason="CPython-specific implementation detail"):
     """A decorator to skip a whole function if not running on top of CPython.
     """
-    if check_impl_detail:
-        return f
-    else:
-        def _skip_check_impl_detail(*args, **kwds):
-            if verbose:
-                sys.stderr.write("Skipping %s checking CPython-specific "
-                                 "implementation details\n" % (f.__name__,))
-            return
-        return _skip_check_impl_detail
+    assert isinstance(reason, basestring)
+    def decorator(f):
+        if check_impl_detail:
+            return f
+        else:
+            def _skip_check_impl_detail(*args, **kwds):
+                if verbose:
+                    sys.stderr.write("Skipping %s: %s\n" % (f.__name__,
+                                                            reason))
+                return
+            return _skip_check_impl_detail
+    return decorator
 
 def gc_collect():
     """Force as many objects as possible to be collected.

Modified: pypy/trunk/lib-python/modified-2.5.2/test/test_weakref.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/test/test_weakref.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/test/test_weakref.py	Thu Oct 30 15:00:51 2008
@@ -528,7 +528,7 @@
         del c1, c2, C, D
         gc.collect()
 
-    @test_support.impl_detail
+    @test_support.impl_detail("details of weakref behavior")
     def test_callback_in_cycle_resurrection(self):
         # We can't guarrantee the behaviour tested with our
         # current weakref implementations.
@@ -579,7 +579,7 @@
         gc.collect()
         self.assertEqual(alist, [])
 
-    @test_support.impl_detail
+    @test_support.impl_detail("details of weakref behavior")
     def test_callbacks_on_callback(self):
         # See test_callback_in_cycle_resurrection above
         import gc



More information about the Pypy-commit mailing list