[Jython-checkins] jython: Increase the count of gc.collect() in test_weakset to hopefully reduce the

darjus.loktevic jython-checkins at python.org
Wed Feb 3 21:09:27 EST 2016


https://hg.python.org/jython/rev/1c6afdc3132e
changeset:   7896:1c6afdc3132e
user:        Darjus Loktevic <darjus at gmail.com>
date:        Thu Feb 04 13:09:18 2016 +1100
summary:
  Increase the count of gc.collect() in test_weakset to hopefully reduce the flakiness of the tests

files:
  Lib/test/test_weakset.py |  10 +++++++---
  1 files changed, 7 insertions(+), 3 deletions(-)


diff --git a/Lib/test/test_weakset.py b/Lib/test/test_weakset.py
--- a/Lib/test/test_weakset.py
+++ b/Lib/test/test_weakset.py
@@ -415,7 +415,9 @@
             finally:
                 it = None           # should commit all removals
 
-        gc.collect(); gc.collect()  # final before asserts
+        for _ in xrange(10):
+            gc.collect()
+
         with testcontext() as u:
             self.assertNotIn(u, s)
         with testcontext() as u:
@@ -446,8 +448,10 @@
         gc.collect()
         n1 = len(s)
         del it
-        gc.collect()
-        gc.collect()
+        # do some gc
+        for _ in xrange(10):
+            gc.collect()
+
         n2 = len(s)
         # one item may be kept alive inside the iterator
         self.assertIn(n1, (0, 1))

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list