On 2024/09/26 6:43, Yasuhito FUTATSUKI wrote:
> However, if weakref for 'handler' object might still remain after
> the last strong reference is cleared, this test is incomplete and
> it should rewrite to a test based on sys.getrefcount().

Or ensure that weakref is cleared by gc.

How about with this patch? (This is against trunk, but it can be
clearly applied against 1.14.x)
[[[
Index: subversion/bindings/swig/python/tests/repository.py
===================================================================
--- subversion/bindings/swig/python/tests/repository.py (revision 1920850)
+++ subversion/bindings/swig/python/tests/repository.py (working copy)
@@ -18,7 +18,7 @@
 # under the License.
 #
 #
-import unittest, setup_path, os, sys, weakref
+import unittest, setup_path, os, sys, weakref, gc
 from sys import version_info # For Python version check
 from io import BytesIO
 from svn import core, repos, fs, delta
@@ -314,6 +314,7 @@ class SubversionRepositoryTestCase(unittest.TestCa
     del ptr, baton, subpool, dsp
     self.assertEqual(True, stream.closed)
     # Issue SVN-4918
+    gc.collect()
     self.assertEqual(None, dsp_ref())

   def test_parse_fns3_invalid_set_fulltext(self):
@@ -356,6 +357,7 @@ class SubversionRepositoryTestCase(unittest.TestCa
     self.assertIn('apply_textdelta', parser.called)
     self.assertNotEqual(None, handler_ref())
     del parser, handler, subpool, ParseFns3
+    gc.collect()
     self.assertEqual(None, handler_ref())

   def test_get_logs(self):
]]]

Cheers,
-- 
Yasuhito FUTATSUKI <futat...@yf.bsdclub.org>

Reply via email to