[Jython-checkins] jython: Systematic sweep of flaky tests in test_weakref

jim.baker jython-checkins at python.org
Tue Dec 9 08:03:42 CET 2014


https://hg.python.org/jython/rev/ebb6d9049d15
changeset:   7443:ebb6d9049d15
user:        Jim Baker <jim.baker at rackspace.com>
date:        Tue Dec 09 00:03:35 2014 -0700
summary:
  Systematic sweep of flaky tests in test_weakref

Attempt to identify all use of weakref callbacks to ensure
extra_collect() is called to ensure reaper thread can do its work.

files:
  Lib/test/test_weakref.py |  10 +++++-----
  1 files changed, 5 insertions(+), 5 deletions(-)


diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -638,7 +638,7 @@
         del c1, c2, C   # make them all trash
         self.assertEqual(alist, [])  # del isn't enough to reclaim anything
 
-        gc.collect()
+        extra_collect()
         # c1.wr and c2.wr were part of the cyclic trash, so should have
         # been cleared without their callbacks executing.  OTOH, the weakref
         # to C is bound to a function local (wr), and wasn't trash, so that
@@ -682,7 +682,7 @@
 
         del callback, c, d, C
         self.assertEqual(alist, [])  # del isn't enough to clean up cycles
-        gc.collect()
+        extra_collect()
         self.assertEqual(alist, ["safe_callback called"])
         self.assertEqual(external_wr(), None)
 
@@ -755,12 +755,12 @@
         weakref.ref(int)
         a = weakref.ref(A, l.append)
         A = None
-        gc.collect()
+        extra_collect()
         self.assertEqual(a(), None)
         self.assertEqual(l, [a])
         b = weakref.ref(B, l.append)
         B = None
-        gc.collect()
+        extra_collect()
         self.assertEqual(b(), None)
         self.assertEqual(l, [a, b])
 
@@ -850,7 +850,7 @@
         self.assertTrue(mr.called)
         self.assertEqual(mr.value, 24)
         del o
-        gc.collect()
+        extra_collect()
         self.assertTrue(mr() is None)
         self.assertTrue(mr.called)
 

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


More information about the Jython-checkins mailing list