mirror of https://github.com/scrapy/scrapy.git
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.
This commit is contained in:
parent
c3d17659b3
commit
5abb70c8d7
|
|
@ -1,3 +1,4 @@
|
|||
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")
|
||||
|
|
|
|||
Loading…
Reference in New Issue