[pypy-commit] pypy py3.6: tests should gc.collect before checking weakrefs

mattip pypy.commits at gmail.com
Sat Sep 7 08:06:44 EDT 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: py3.6
Changeset: r97399:831c8760bfbd
Date: 2019-09-07 14:06 +0200
http://bitbucket.org/pypy/pypy/changeset/831c8760bfbd/

Log:	tests should gc.collect before checking weakrefs

diff --git a/lib-python/3/test/test_concurrent_futures.py b/lib-python/3/test/test_concurrent_futures.py
--- a/lib-python/3/test/test_concurrent_futures.py
+++ b/lib-python/3/test/test_concurrent_futures.py
@@ -428,6 +428,7 @@
                 futures_list.remove(future)
                 wr = weakref.ref(future)
                 del future
+                test.support.gc_collect()
                 self.assertIsNone(wr())
 
         futures_list[0].set_result("test")
@@ -435,6 +436,7 @@
             futures_list.remove(future)
             wr = weakref.ref(future)
             del future
+            test.support.gc_collect()
             self.assertIsNone(wr())
             if futures_list:
                 futures_list[0].set_result("test")
@@ -533,6 +535,7 @@
         for obj in self.executor.map(make_dummy_object, range(10)):
             wr = weakref.ref(obj)
             del obj
+            test.support.gc_collect()
             self.assertIsNone(wr())
 
 


More information about the pypy-commit mailing list