[pypy-commit] pypy default: kill flaky test

rlamy pypy.commits at gmail.com
Fri Aug 9 12:14:05 EDT 2019


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: 
Changeset: r97127:a46bede6925d
Date: 2019-08-09 17:13 +0100
http://bitbucket.org/pypy/pypy/changeset/a46bede6925d/

Log:	kill flaky test

diff --git a/pypy/objspace/std/test/test_methodcache.py b/pypy/objspace/std/test/test_methodcache.py
--- a/pypy/objspace/std/test/test_methodcache.py
+++ b/pypy/objspace/std/test/test_methodcache.py
@@ -72,46 +72,6 @@
             assert cache_counter[1] >= 2 # should be (18, 2)
             assert sum(cache_counter) == 20
 
-    def test_change_methods(self):
-        @self.retry
-        def run():
-            import __pypy__
-            class A(object):
-                def f(self):
-                    return 42
-            l = [A()] * 10
-            __pypy__.reset_method_cache_counter()
-            for i, a in enumerate(l):
-                assert a.f() == 42 + i
-                A.f = eval("lambda self: %s" % (42 + i + 1, ))
-            cache_counter = __pypy__.method_cache_counter("f")
-            #
-            # a bit of explanation about what's going on.  (1) is the line "a.f()"
-            # and (2) is "A.f = ...".
-            #
-            # at line (1) we do the lookup on type(a).f
-            #
-            # at line (2) we do a setattr on A. However, descr_setattr does also a
-            # lookup of type(A).f i.e. type.f, to check if by chance 'f' is a data
-            # descriptor.
-            #
-            # At the first iteration:
-            # (1) is a miss because it's the first lookup of A.f. The result is cached
-            #
-            # (2) is a miss because it is the first lookup of type.f. The
-            # (non-existant) result is cached. The version of A changes, and 'f'
-            # is changed to be a cell object, so that subsequest assignments won't
-            # change the version of A
-            #
-            # At the second iteration:
-            # (1) is a miss because the version of A changed just before
-            # (2) is a hit, because type.f is cached. The version of A no longer changes
-            #
-            # At the third and subsequent iterations:
-            # (1) is a hit, because the version of A did not change
-            # (2) is a hit, see above
-            assert cache_counter == (17, 3)
-
     def test_subclasses(self):
         @self.retry
         def run():


More information about the pypy-commit mailing list