[pypy-commit] pypy default: add gc.collect to fix test on bencher4

mattip pypy.commits at gmail.com
Sun Jun 16 01:12:57 EDT 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r96809:53fb62020937
Date: 2019-06-16 08:11 +0300
http://bitbucket.org/pypy/pypy/changeset/53fb62020937/

Log:	add gc.collect to fix test on bencher4

diff --git a/pypy/module/thread/test/test_local.py b/pypy/module/thread/test/test_local.py
--- a/pypy/module/thread/test/test_local.py
+++ b/pypy/module/thread/test/test_local.py
@@ -5,6 +5,7 @@
 
     def test_local_1(self):
         import thread
+        import gc
         from thread import _local as tlsobject
         freed = []
         class X:
@@ -34,8 +35,9 @@
             thread.start_new_thread(f, (i,))
         self.waitfor(lambda: len(ok) == 20, delay=3)
         assert ok == 20*[True] # see stdout/stderr for failures in the threads
+        gc.collect(); gc.collect(); gc.collect()
 
-        self.waitfor(lambda: len(freed) >= 40)
+        self.waitfor(lambda: len(freed) >= 40, delay=20)
         assert len(freed) == 40
         #  in theory, all X objects should have been freed by now.  Note that
         #  Python's own thread._local objects suffer from the very same "bug" that


More information about the pypy-commit mailing list