[Jython-checkins] jython: Resolve test_file2k weak reference test failure.

jeff.allen jython-checkins at python.org
Sat Nov 30 17:52:49 CET 2013


http://hg.python.org/jython/rev/512780fedc0a
changeset:   7159:512780fedc0a
user:        Jeff Allen <ja.py at farowl.co.uk>
date:        Sat Nov 23 09:21:12 2013 +0000
summary:
  Resolve test_file2k weak reference test failure.
This change set borrows the technique, used elsewhere in the suite, of
giving Java GC a chance to operate before testing reference expiration.

files:
  Lib/test/test_file2k.py |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_file2k.py b/Lib/test/test_file2k.py
--- a/Lib/test/test_file2k.py
+++ b/Lib/test/test_file2k.py
@@ -25,7 +25,6 @@
             self.f.close()
         os.remove(TESTFN)
 
-    @unittest.skipIf(test_support.is_jython, "FIXME: Not working on Jython")
     def testWeakRefs(self):
         # verify weak references
         p = proxy(self.f)
@@ -33,6 +32,9 @@
         self.assertEqual(self.f.tell(), p.tell())
         self.f.close()
         self.f = None
+        if test_support.is_jython: # GC is not immediate: borrow a trick
+            from test_weakref import extra_collect
+            extra_collect()
         self.assertRaises(ReferenceError, getattr, p, 'tell')
 
     def testAttributes(self):

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


More information about the Jython-checkins mailing list