[3.9] bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005). (GH-28028)

(cherry picked from commit 2a8127cafe)
This commit is contained in:
Serhiy Storchaka 2021-08-29 15:08:32 +03:00 committed by GitHub
parent dab74d68e3
commit 330aabbbbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 143 additions and 15 deletions

View file

@ -7,6 +7,7 @@ import abc
from operator import le, lt, ge, gt, eq, ne
import unittest
from test import support
order_comparisons = le, lt, ge, gt
equality_comparisons = eq, ne
@ -816,6 +817,7 @@ class TestCopy(unittest.TestCase):
self.assertEqual(v[c], d)
self.assertEqual(len(v), 2)
del c, d
support.gc_collect() # For PyPy or other GCs.
self.assertEqual(len(v), 1)
x, y = C(), C()
# The underlying containers are decoupled
@ -845,6 +847,7 @@ class TestCopy(unittest.TestCase):
self.assertEqual(v[a].i, b.i)
self.assertEqual(v[c].i, d.i)
del c
support.gc_collect() # For PyPy or other GCs.
self.assertEqual(len(v), 1)
def test_deepcopy_weakvaluedict(self):
@ -868,6 +871,7 @@ class TestCopy(unittest.TestCase):
self.assertIs(t, d)
del x, y, z, t
del d
support.gc_collect() # For PyPy or other GCs.
self.assertEqual(len(v), 1)
def test_deepcopy_bound_method(self):