[pypy-commit] pypy py3.3: Apply all PyPy specific tweaks to the test suite that were removed with the merge of stdlib 3.3.
amauryfa
noreply at buildbot.pypy.org
Sun Jul 27 18:03:08 CEST 2014
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3.3
Changeset: r72572:d9b7e7669d2b
Date: 2014-07-27 18:02 +0200
http://bitbucket.org/pypy/pypy/changeset/d9b7e7669d2b/
Log: Apply all PyPy specific tweaks to the test suite that were removed
with the merge of stdlib 3.3.
diff --git a/lib-python/3/test/test_audioop.py b/lib-python/3/test/test_audioop.py
--- a/lib-python/3/test/test_audioop.py
+++ b/lib-python/3/test/test_audioop.py
@@ -1,6 +1,7 @@
import audioop
import sys
import unittest
+from test.support import run_unittest, impl_detail
def pack(width, data):
return b''.join(v.to_bytes(width, sys.byteorder, signed=True) for v in data)
@@ -170,6 +171,7 @@
self.assertEqual(audioop.lin2lin(datas[4], 4, 2),
packs[2](0, 0x1234, 0x4567, -0x4568, 0x7fff, -0x8000, -1))
+ @impl_detail(pypy=False)
def test_adpcm2lin(self):
self.assertEqual(audioop.adpcm2lin(b'\x07\x7f\x7f', 1, None),
(b'\x00\x00\x00\xff\x00\xff', (-179, 40)))
@@ -184,6 +186,7 @@
self.assertEqual(audioop.adpcm2lin(b'\0' * 5, w, None),
(b'\0' * w * 10, (0, 0)))
+ @impl_detail(pypy=False)
def test_lin2adpcm(self):
self.assertEqual(audioop.lin2adpcm(datas[1], 1, None),
(b'\x07\x7f\x7f', (-221, 39)))
@@ -197,6 +200,7 @@
self.assertEqual(audioop.lin2adpcm(b'\0' * w * 10, w, None),
(b'\0' * 5, (0, 0)))
+ @impl_detail(pypy=False)
def test_lin2alaw(self):
self.assertEqual(audioop.lin2alaw(datas[1], 1),
b'\xd5\x87\xa4\x24\xaa\x2a\x5a')
@@ -205,6 +209,7 @@
self.assertEqual(audioop.lin2alaw(datas[4], 4),
b'\xd5\x87\xa4\x24\xaa\x2a\x55')
+ @impl_detail(pypy=False)
def test_alaw2lin(self):
encoded = b'\x00\x03\x24\x2a\x51\x54\x55\x58\x6b\x71\x7f'\
b'\x80\x83\xa4\xaa\xd1\xd4\xd5\xd8\xeb\xf1\xff'
@@ -219,6 +224,7 @@
decoded = audioop.alaw2lin(encoded, w)
self.assertEqual(audioop.lin2alaw(decoded, w), encoded)
+ @impl_detail(pypy=False)
def test_lin2ulaw(self):
self.assertEqual(audioop.lin2ulaw(datas[1], 1),
b'\xff\xad\x8e\x0e\x80\x00\x67')
@@ -227,6 +233,7 @@
self.assertEqual(audioop.lin2ulaw(datas[4], 4),
b'\xff\xad\x8e\x0e\x80\x00\x7e')
+ @impl_detail(pypy=False)
def test_ulaw2lin(self):
encoded = b'\x00\x0e\x28\x3f\x57\x6a\x76\x7c\x7e\x7f'\
b'\x80\x8e\xa8\xbf\xd7\xea\xf6\xfc\xfe\xff'
@@ -341,6 +348,7 @@
self.assertRaises(audioop.error,
audioop.findmax, bytes(range(256)), -2392392)
+ @impl_detail(pypy=False)
def test_issue7673(self):
state = None
for data, size in INVALID_DATA:
@@ -365,6 +373,7 @@
self.assertRaises(audioop.error, audioop.lin2alaw, data, size)
self.assertRaises(audioop.error, audioop.lin2adpcm, data, size, state)
+ @impl_detail(pypy=False)
def test_wrongsize(self):
data = b'abcdefgh'
state = None
diff --git a/lib-python/3/test/test_capi.py b/lib-python/3/test/test_capi.py
--- a/lib-python/3/test/test_capi.py
+++ b/lib-python/3/test/test_capi.py
@@ -110,6 +110,8 @@
self.assertRaises(TypeError, _posixsubprocess.fork_exec,
Z(),[b'1'],3,[1, 2],5,6,7,8,9,10,11,12,13,14,15,16,17)
+ at unittest.skipIf(support.check_impl_detail(pypy=True),
+ 'Py_AddPendingCall not currently supported.')
@unittest.skipUnless(threading, 'Threading required for this test.')
class TestPendingCalls(unittest.TestCase):
@@ -327,6 +329,8 @@
self.assertRaises(ValueError, _testcapi.parse_tuple_and_keywords,
(), {}, b'', [42])
+ at unittest.skipIf(support.check_impl_detail(pypy=True),
+ 'Not currently supported under PyPy')
@unittest.skipUnless(threading, 'Threading required for this test.')
class TestThreadState(unittest.TestCase):
diff --git a/lib-python/3/test/test_descr.py b/lib-python/3/test/test_descr.py
--- a/lib-python/3/test/test_descr.py
+++ b/lib-python/3/test/test_descr.py
@@ -1196,7 +1196,7 @@
self.assertEqual(Counted.counter, 0)
# Test lookup leaks [SF bug 572567]
- if hasattr(gc, 'get_objects'):
+ if hasattr(gc, 'get_objects') and support.check_impl_detail(pypy=False):
class G(object):
def __eq__(self, other):
return False
@@ -3035,15 +3035,24 @@
class R(J):
__slots__ = ["__dict__", "__weakref__"]
- for cls, cls2 in ((G, H), (G, I), (I, H), (Q, R), (R, Q)):
+ if support.check_impl_detail(pypy=False):
+ lst = ((G, H), (G, I), (I, H), (Q, R), (R, Q))
+ else:
+ # Not supported in pypy: changing the __class__ of an object
+ # to another __class__ that just happens to have the same slots.
+ # If needed, we can add the feature, but what we'll likely do
+ # then is to allow mostly any __class__ assignment, even if the
+ # classes have different __slots__, because we it's easier.
+ lst = ((Q, R), (R, Q))
+ for cls, cls2 in lst:
x = cls()
x.a = 1
x.__class__ = cls2
- self.assertIs(x.__class__, cls2,
+ self.assertTrue(x.__class__ is cls2,
"assigning %r as __class__ for %r silently failed" % (cls2, x))
self.assertEqual(x.a, 1)
x.__class__ = cls
- self.assertIs(x.__class__, cls,
+ self.assertTrue(x.__class__ is cls,
"assigning %r as __class__ for %r silently failed" % (cls, x))
self.assertEqual(x.a, 1)
for cls in G, J, K, L, M, N, P, R, list, Int:
@@ -3055,7 +3064,8 @@
# Issue5283: when __class__ changes in __del__, the wrong
# type gets DECREF'd.
class O(object):
- pass
+ def __del__(self):
+ pass
class A(object):
def __del__(self):
self.__class__ = O
@@ -3118,7 +3128,8 @@
except TypeError:
pass
else:
- self.fail("%r's __dict__ can be modified" % cls)
+ if support.check_impl_detail(pypy=False):
+ self.fail("%r's __dict__ can be modified" % cls)
# Modules also disallow __dict__ assignment
class Module1(types.ModuleType, Base):
diff --git a/lib-python/3/test/test_exceptions.py b/lib-python/3/test/test_exceptions.py
--- a/lib-python/3/test/test_exceptions.py
+++ b/lib-python/3/test/test_exceptions.py
@@ -512,6 +512,7 @@
except MyException as e:
pass
obj = None
+ gc_collect()
obj = wr()
self.assertTrue(obj is None, "%s" % obj)
@@ -523,6 +524,7 @@
except MyException:
pass
obj = None
+ gc_collect()
obj = wr()
self.assertTrue(obj is None, "%s" % obj)
@@ -534,6 +536,7 @@
except:
pass
obj = None
+ gc_collect()
obj = wr()
self.assertTrue(obj is None, "%s" % obj)
@@ -546,6 +549,7 @@
except:
break
obj = None
+ gc_collect() # XXX it seems it's not enough
obj = wr()
self.assertTrue(obj is None, "%s" % obj)
@@ -564,6 +568,7 @@
# must clear the latter manually for our test to succeed.
e.__context__ = None
obj = None
+ gc_collect()
obj = wr()
# guarantee no ref cycles on CPython (don't gc_collect)
if check_impl_detail(cpython=False):
@@ -708,6 +713,7 @@
next(g)
testfunc(g)
g = obj = None
+ gc_collect()
obj = wr()
self.assertIs(obj, None)
@@ -761,6 +767,7 @@
raise Exception(MyObject())
except:
pass
+ gc_collect()
self.assertEqual(e, (None, None, None))
def testUnicodeChangeAttributes(self):
@@ -911,6 +918,7 @@
self.assertNotEqual(wr(), None)
else:
self.fail("MemoryError not raised")
+ gc_collect()
self.assertEqual(wr(), None)
@no_tracing
@@ -931,6 +939,7 @@
self.assertNotEqual(wr(), None)
else:
self.fail("RuntimeError not raised")
+ gc_collect()
self.assertEqual(wr(), None)
def test_errno_ENOTDIR(self):
diff --git a/lib-python/3/test/test_fileio.py b/lib-python/3/test/test_fileio.py
--- a/lib-python/3/test/test_fileio.py
+++ b/lib-python/3/test/test_fileio.py
@@ -10,6 +10,7 @@
from functools import wraps
from test.support import TESTFN, check_warnings, run_unittest, make_bad_fd, cpython_only
+from test.support import gc_collect
from collections import UserList
from _io import FileIO as _FileIO
@@ -32,6 +33,7 @@
self.assertEqual(self.f.tell(), p.tell())
self.f.close()
self.f = None
+ gc_collect()
self.assertRaises(ReferenceError, getattr, p, 'tell')
def testSeekTell(self):
diff --git a/lib-python/3/test/test_functools.py b/lib-python/3/test/test_functools.py
--- a/lib-python/3/test/test_functools.py
+++ b/lib-python/3/test/test_functools.py
@@ -45,6 +45,8 @@
self.assertEqual(p.args, (1, 2))
self.assertEqual(p.keywords, dict(a=10, b=20))
# attributes should not be writable
+ if not support.check_impl_detail():
+ return
self.assertRaises(AttributeError, setattr, p, 'func', map)
self.assertRaises(AttributeError, setattr, p, 'args', (1, 2))
self.assertRaises(AttributeError, setattr, p, 'keywords', dict(a=1, b=2))
@@ -136,6 +138,7 @@
p = proxy(f)
self.assertEqual(f.func, p.func)
f = None
+ support.gc_collect()
self.assertRaises(ReferenceError, getattr, p, 'func')
def test_with_bound_and_unbound_methods(self):
@@ -192,9 +195,13 @@
raise IndexError
f = self.thetype(object)
- self.assertRaisesRegex(SystemError,
- "new style getargs format but argument is not a tuple",
- f.__setstate__, BadSequence())
+ if support.check_impl_detail(pypy=True):
+ # CPython fails, pypy does not :-)
+ f.__setstate__(BadSequence())
+ else:
+ self.assertRaisesRegex(SystemError,
+ "new style getargs format but argument is not a tuple",
+ f.__setstate__, BadSequence())
class PartialSubclass(functools.partial):
pass
@@ -223,7 +230,7 @@
updated=functools.WRAPPER_UPDATES):
# Check attributes were assigned
for name in assigned:
- self.assertTrue(getattr(wrapper, name) is getattr(wrapped, name))
+ self.assertTrue(getattr(wrapper, name) == getattr(wrapped, name))
# Check attributes were updated
for name in updated:
wrapper_attr = getattr(wrapper, name)
diff --git a/lib-python/3/test/test_imp.py b/lib-python/3/test/test_imp.py
--- a/lib-python/3/test/test_imp.py
+++ b/lib-python/3/test/test_imp.py
@@ -317,6 +317,7 @@
@unittest.skipUnless(sys.implementation.cache_tag is not None,
'requires sys.implementation.cache_tag not be None')
+ @support.impl_detail("PyPy ignores the optimize flag", pypy=False)
def test_cache_from_source(self):
# Given the path to a .py file, return the path to its PEP 3147
# defined .pyc file (i.e. under __pycache__).
@@ -338,6 +339,7 @@
'file{}.pyc'.format(self.tag))
self.assertEqual(imp.cache_from_source(path, True), expect)
+ @support.impl_detail("PyPy ignores the optimize flag", pypy=False)
def test_cache_from_source_optimized(self):
# Given the path to a .py file, return the path to its PEP 3147
# defined .pyo file (i.e. under __pycache__).
diff --git a/lib-python/3/test/test_int.py b/lib-python/3/test/test_int.py
--- a/lib-python/3/test/test_int.py
+++ b/lib-python/3/test/test_int.py
@@ -307,9 +307,10 @@
try:
int(TruncReturnsNonIntegral())
except TypeError as e:
- self.assertEqual(str(e),
- "__trunc__ returned non-Integral"
- " (type NonIntegral)")
+ if support.check_impl_detail(pypy=False):
+ self.assertEqual(str(e),
+ "__trunc__ returned non-Integral"
+ " (type NonIntegral)")
else:
self.fail("Failed to raise TypeError with %s" %
((base, trunc_result_base),))
diff --git a/lib-python/3/test/test_marshal.py b/lib-python/3/test/test_marshal.py
--- a/lib-python/3/test/test_marshal.py
+++ b/lib-python/3/test/test_marshal.py
@@ -203,6 +203,7 @@
s = b'c' + (b'X' * 4*4) + b'{' * 2**20
self.assertRaises(ValueError, marshal.loads, s)
+ @support.impl_detail('specific recursion check')
def test_recursion_limit(self):
# Create a deeply nested structure.
head = last = []
@@ -291,6 +292,10 @@
LARGE_SIZE = 2**31
pointer_size = 8 if sys.maxsize > 0xFFFFFFFF else 4
+if support.check_impl_detail(pypy=False):
+ sizeof_large_size = sys.getsizeof(LARGE_SIZE-1)
+else:
+ sizeof_large_size = 32 # Some value for PyPy
class NullWriter:
def write(self, s):
@@ -318,13 +323,13 @@
self.check_unmarshallable([None] * size)
@support.bigmemtest(size=LARGE_SIZE,
- memuse=pointer_size*12 + sys.getsizeof(LARGE_SIZE-1),
+ memuse=pointer_size*12 + sizeof_large_size,
dry_run=False)
def test_set(self, size):
self.check_unmarshallable(set(range(size)))
@support.bigmemtest(size=LARGE_SIZE,
- memuse=pointer_size*12 + sys.getsizeof(LARGE_SIZE-1),
+ memuse=pointer_size*12 + sizeof_large_size,
dry_run=False)
def test_frozenset(self, size):
self.check_unmarshallable(frozenset(range(size)))
diff --git a/lib-python/3/test/test_peepholer.py b/lib-python/3/test/test_peepholer.py
--- a/lib-python/3/test/test_peepholer.py
+++ b/lib-python/3/test/test_peepholer.py
@@ -81,10 +81,13 @@
self.assertIn(elem, asm)
def test_pack_unpack(self):
+ # On PyPy, "a, b = ..." is even more optimized, by removing
+ # the ROT_TWO. But the ROT_TWO is not removed if assigning
+ # to more complex expressions, so check that.
for line, elem in (
('a, = a,', 'LOAD_CONST',),
- ('a, b = a, b', 'ROT_TWO',),
- ('a, b, c = a, b, c', 'ROT_THREE',),
+ ('a[1], b = a, b', 'ROT_TWO',),
+ ('a, b[2], c = a, b, c', 'ROT_THREE',),
):
asm = dis_single(line)
self.assertIn(elem, asm)
@@ -92,6 +95,8 @@
self.assertNotIn('UNPACK_TUPLE', asm)
def test_folding_of_tuples_of_constants(self):
+ # On CPython, "a,b,c=1,2,3" turns into "a,b,c=<constant (1,2,3)>"
+ # but on PyPy, it turns into "a=1;b=2;c=3".
for line, elem in (
('a = 1,2,3', '((1, 2, 3))'),
('("a","b","c")', "(('a', 'b', 'c'))"),
@@ -100,7 +105,8 @@
('((1, 2), 3, 4)', '(((1, 2), 3, 4))'),
):
asm = dis_single(line)
- self.assertIn(elem, asm)
+ self.assert_(elem in asm or (
+ line == 'a,b,c = 1,2,3' and 'UNPACK_TUPLE' not in asm))
self.assertNotIn('BUILD_TUPLE', asm)
# Long tuples should be folded too.
diff --git a/lib-python/3/test/test_subprocess.py b/lib-python/3/test/test_subprocess.py
--- a/lib-python/3/test/test_subprocess.py
+++ b/lib-python/3/test/test_subprocess.py
@@ -1314,6 +1314,7 @@
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, preexec_fn=raise_it)
+ @support.impl_detail("PyPy's _posixsubprocess doesn't have to disable gc")
def test_preexec_gc_module_failure(self):
# This tests the code that disables garbage collection if the child
# process will execute any Python.
@@ -1964,6 +1965,7 @@
ident = id(p)
pid = p.pid
del p
+ support.gc_collect()
# check that p is in the active processes list
self.assertIn(ident, [id(o) for o in subprocess._active])
@@ -1983,6 +1985,7 @@
ident = id(p)
pid = p.pid
del p
+ support.gc_collect()
os.kill(pid, signal.SIGKILL)
# check that p is in the active processes list
self.assertIn(ident, [id(o) for o in subprocess._active])
diff --git a/lib-python/3/test/test_sys.py b/lib-python/3/test/test_sys.py
--- a/lib-python/3/test/test_sys.py
+++ b/lib-python/3/test/test_sys.py
@@ -405,8 +405,10 @@
self.assertEqual(len(sys.float_info), 11)
self.assertEqual(sys.float_info.radix, 2)
self.assertEqual(len(sys.int_info), 2)
- self.assertTrue(sys.int_info.bits_per_digit % 5 == 0)
- self.assertTrue(sys.int_info.sizeof_digit >= 1)
+ if test.support.check_impl_detail(cpython=True):
+ self.assertTrue(sys.int_info.bits_per_digit % 5 == 0)
+ else:
+ self.assertTrue(sys.int_info.sizeof_digit >= 1)
self.assertEqual(type(sys.int_info.bits_per_digit), int)
self.assertEqual(type(sys.int_info.sizeof_digit), int)
self.assertIsInstance(sys.hexversion, int)
@@ -503,6 +505,7 @@
self.assertTrue(repr(sys.flags))
self.assertEqual(len(sys.flags), len(attrs))
+ @test.support.impl_detail("sys._clear_type_cache", pypy=False)
def test_clear_type_cache(self):
sys._clear_type_cache()
diff --git a/lib-python/3/test/test_weakref.py b/lib-python/3/test/test_weakref.py
--- a/lib-python/3/test/test_weakref.py
+++ b/lib-python/3/test/test_weakref.py
@@ -8,6 +8,7 @@
import copy
from test import support
+from test.support import gc_collect
# Used in ReferencesTestCase.test_ref_created_during_del() .
ref_from_del = None
@@ -88,6 +89,7 @@
ref1 = weakref.ref(o, self.callback)
ref2 = weakref.ref(o, self.callback)
del o
+ gc_collect()
self.assertIsNone(ref1(), "expected reference to be invalidated")
self.assertIsNone(ref2(), "expected reference to be invalidated")
self.assertEqual(self.cbcalled, 2,
@@ -117,13 +119,16 @@
ref1 = weakref.proxy(o, self.callback)
ref2 = weakref.proxy(o, self.callback)
del o
+ gc_collect()
def check(proxy):
proxy.bar
self.assertRaises(ReferenceError, check, ref1)
self.assertRaises(ReferenceError, check, ref2)
- self.assertRaises(ReferenceError, bool, weakref.proxy(C()))
+ ref3 = weakref.proxy(C())
+ gc_collect()
+ self.assertRaises(ReferenceError, bool, ref3)
self.assertEqual(self.cbcalled, 2)
def check_basic_ref(self, factory):
@@ -140,6 +145,7 @@
o = factory()
ref = weakref.ref(o, self.callback)
del o
+ gc_collect()
self.assertEqual(self.cbcalled, 1,
"callback did not properly set 'cbcalled'")
self.assertIsNone(ref(),
@@ -164,6 +170,7 @@
self.assertEqual(weakref.getweakrefcount(o), 2,
"wrong weak ref count for object")
del proxy
+ gc_collect()
self.assertEqual(weakref.getweakrefcount(o), 1,
"wrong weak ref count for object after deleting proxy")
@@ -338,6 +345,7 @@
"got wrong number of weak reference objects")
del ref1, ref2, proxy1, proxy2
+ gc_collect()
self.assertEqual(weakref.getweakrefcount(o), 0,
"weak reference objects not unlinked from"
" referent when discarded.")
@@ -351,6 +359,7 @@
ref1 = weakref.ref(o, self.callback)
ref2 = weakref.ref(o, self.callback)
del ref1
+ gc_collect()
self.assertEqual(weakref.getweakrefs(o), [ref2],
"list of refs does not match")
@@ -358,10 +367,12 @@
ref1 = weakref.ref(o, self.callback)
ref2 = weakref.ref(o, self.callback)
del ref2
+ gc_collect()
self.assertEqual(weakref.getweakrefs(o), [ref1],
"list of refs does not match")
del ref1
+ gc_collect()
self.assertEqual(weakref.getweakrefs(o), [],
"list of refs not cleared")
@@ -647,9 +658,11 @@
gc.collect()
self.assertEqual(alist, [])
+ @support.impl_detail(pypy=False)
def test_gc_during_ref_creation(self):
self.check_gc_during_creation(weakref.ref)
+ @support.impl_detail(pypy=False)
def test_gc_during_proxy_creation(self):
self.check_gc_during_creation(weakref.proxy)
@@ -811,6 +824,7 @@
self.assertTrue(mr.called)
self.assertEqual(mr.value, 24)
del o
+ gc_collect()
self.assertIsNone(mr())
self.assertTrue(mr.called)
@@ -917,6 +931,7 @@
n1 = len(dct)
del it
gc.collect()
+ gc.collect()
n2 = len(dct)
# one item may be kept alive inside the iterator
self.assertIn(n1, (0, 1))
@@ -928,6 +943,7 @@
def test_weak_valued_len_cycles(self):
self.check_len_cycles(weakref.WeakValueDictionary, lambda k: (1, k))
+ @support.impl_detail(pypy=False)
def check_len_race(self, dict_type, cons):
# Extended sanity checks for len() in the face of cyclic collection
self.addCleanup(gc.set_threshold, *gc.get_threshold())
@@ -976,15 +992,18 @@
del items1, items2
self.assertEqual(len(dict), self.COUNT)
del objects[0]
+ gc_collect()
self.assertEqual(len(dict), self.COUNT - 1,
"deleting object did not cause dictionary update")
del objects, o
+ gc_collect()
self.assertEqual(len(dict), 0,
"deleting the values did not clear the dictionary")
# regression on SF bug #447152:
dict = weakref.WeakValueDictionary()
self.assertRaises(KeyError, dict.__getitem__, 1)
dict[2] = C()
+ gc_collect()
self.assertRaises(KeyError, dict.__getitem__, 2)
def test_weak_keys(self):
@@ -1005,9 +1024,11 @@
del items1, items2
self.assertEqual(len(dict), self.COUNT)
del objects[0]
+ gc_collect()
self.assertEqual(len(dict), (self.COUNT - 1),
"deleting object did not cause dictionary update")
del objects, o
+ gc_collect()
self.assertEqual(len(dict), 0,
"deleting the keys did not clear the dictionary")
o = Object(42)
@@ -1368,6 +1389,7 @@
for o in objs:
count += 1
del d[o]
+ gc_collect()
self.assertEqual(len(d), 0)
self.assertEqual(count, 2)
@@ -1389,6 +1411,7 @@
libreftest = """ Doctest for examples in the library reference: weakref.rst
+>>> from test.support import gc_collect
>>> import weakref
>>> class Dict(dict):
... pass
@@ -1408,6 +1431,7 @@
>>> o is o2
True
>>> del o, o2
+>>> gc_collect()
>>> print(r())
None
@@ -1460,6 +1484,7 @@
>>> id2obj(a_id) is a
True
>>> del a
+>>> gc_collect()
>>> try:
... id2obj(a_id)
... except KeyError:
diff --git a/lib-python/3/test/test_weakset.py b/lib-python/3/test/test_weakset.py
--- a/lib-python/3/test/test_weakset.py
+++ b/lib-python/3/test/test_weakset.py
@@ -416,11 +416,13 @@
n1 = len(s)
del it
gc.collect()
+ gc.collect()
n2 = len(s)
# one item may be kept alive inside the iterator
self.assertIn(n1, (0, 1))
self.assertEqual(n2, 0)
+ @support.impl_detail("PyPy has no cyclic collection", pypy=False)
def test_len_race(self):
# Extended sanity checks for len() in the face of cyclic collection
self.addCleanup(gc.set_threshold, *gc.get_threshold())
More information about the pypy-commit
mailing list