提交 5abb70c8 编写于 作者: K Konstantin Lopuhin

Fix test_weakkeycache on PyPy: run gc.collect()

One gc.collect() seems to be enough, but it's more reliable
to run it several times (at most 100), until all objects are collected.
上级 c3d17659
import gc
import functools
import operator
import unittest
......@@ -144,6 +145,9 @@ class UtilsPythonTestCase(unittest.TestCase):
self.assertNotEqual(v, wk[_Weakme()])
self.assertEqual(v, wk[k])
del k
for _ in range(100):
if wk._weakdict:
gc.collect()
self.assertFalse(len(wk._weakdict))
@unittest.skipUnless(six.PY2, "deprecated function")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册