[3.10] bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005) (GH-28027)
(cherry picked from commit 2a8127cafe1d196f858a3ecabf5f1df3eebf9a12)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py
index ba3d233..f1ca8cb 100644
--- a/Lib/test/test_copy.py
+++ b/Lib/test/test_copy.py
@@ -7,6 +7,7 @@
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
@@ -805,6 +806,7 @@ class C(object):
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
@@ -834,6 +836,7 @@ def __init__(self, i):
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):
@@ -857,6 +860,7 @@ def __init__(self, i):
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):