[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_scope.py b/Lib/test/test_scope.py
index 4239b26..59d5912 100644
--- a/Lib/test/test_scope.py
+++ b/Lib/test/test_scope.py
@@ -2,6 +2,7 @@
 import weakref
 
 from test.support import check_syntax_error, cpython_only
+from test.support import gc_collect
 
 
 class ScopeTests(unittest.TestCase):
@@ -422,6 +423,7 @@ def f2():
         for i in range(100):
             f1()
 
+        gc_collect()  # For PyPy or other GCs.
         self.assertEqual(Foo.count, 0)
 
     def testClassAndGlobal(self):
@@ -754,6 +756,7 @@ def dig(self):
         tester.dig()
         ref = weakref.ref(tester)
         del tester
+        gc_collect()  # For PyPy or other GCs.
         self.assertIsNone(ref())