[pypy-commit] pypy py3.6: add gc.collect to make tests pass skip test that uses gc.threshold

mattip pypy.commits at gmail.com
Sun Aug 18 04:42:39 EDT 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: py3.6
Changeset: r97209:a8ced5af1cae
Date: 2019-08-18 11:40 +0300
http://bitbucket.org/pypy/pypy/changeset/a8ced5af1cae/

Log:	add gc.collect to make tests pass skip test that uses gc.threshold

diff --git a/lib-python/3/test/_test_multiprocessing.py b/lib-python/3/test/_test_multiprocessing.py
--- a/lib-python/3/test/_test_multiprocessing.py
+++ b/lib-python/3/test/_test_multiprocessing.py
@@ -422,6 +422,8 @@
         del c
         p.start()
         p.join()
+        for i in range(3):
+            gc.collect()
         self.assertIs(wr(), None)
         self.assertEqual(q.get(), 5)
         close_queue(q)
@@ -2283,6 +2285,8 @@
         self.pool.map(identity, objs)
 
         del objs
+        for i in range(3):
+            gc.collect()
         time.sleep(DELTA)  # let threaded cleanup code run
         self.assertEqual(set(wr() for wr in refs), {None})
         # With a process pool, copies of the objects are returned, check
@@ -3276,6 +3280,8 @@
         util._finalizer_registry.clear()
 
     def tearDown(self):
+        for i in range(3):
+            gc.collect()
         self.assertFalse(util._finalizer_registry)
         util._finalizer_registry.update(self.registry_backup)
 
@@ -3330,6 +3336,7 @@
         result = [obj for obj in iter(conn.recv, 'STOP')]
         self.assertEqual(result, ['a', 'b', 'd10', 'd03', 'd02', 'd01', 'e'])
 
+    @test.support.cpython_only
     def test_thread_safety(self):
         # bpo-24484: _run_finalizers() should be thread-safe
         def cb():


More information about the pypy-commit mailing list