|
27 | 27 | import test.support |
28 | 28 | import test.support.script_helper |
29 | 29 | from test import support |
30 | | -from test.support import hashlib_helper |
| 30 | +from test.support import hashlib_helper, gc_collect |
31 | 31 | from test.support import import_helper |
32 | 32 | from test.support import os_helper |
33 | 33 | from test.support import socket_helper |
@@ -5306,6 +5306,9 @@ def test_preload_resources(self): |
5306 | 5306 | @unittest.skipIf(sys.platform == "win32", |
5307 | 5307 | "test semantics don't make sense on Windows") |
5308 | 5308 | class TestResourceTracker(unittest.TestCase): |
| 5309 | + # GraalPy change: try trigger all the cleanup, or the leftover finalizers interfere with subsequent tests |
| 5310 | + def tearDown(self): |
| 5311 | + gc_collect() |
5309 | 5312 |
|
5310 | 5313 | def test_resource_tracker(self): |
5311 | 5314 | # |
@@ -5407,7 +5410,7 @@ def check_resource_tracker_death(self, signum, should_die): |
5407 | 5410 | # ensure `sem` gets collected, which triggers communication with |
5408 | 5411 | # the semaphore tracker |
5409 | 5412 | del sem |
5410 | | - gc.collect() |
| 5413 | + gc_collect() |
5411 | 5414 | self.assertIsNone(wr()) |
5412 | 5415 | if should_die: |
5413 | 5416 | self.assertEqual(len(all_warn), 1) |
@@ -5928,7 +5931,7 @@ def tearDownClass(cls): |
5928 | 5931 | f"active children after {dt} seconds") |
5929 | 5932 | break |
5930 | 5933 |
|
5931 | | - gc.collect() # do garbage collection |
| 5934 | + gc_collect() # do garbage collection |
5932 | 5935 | if cls.manager._number_of_objects() != 0: |
5933 | 5936 | # This is not really an error since some tests do not |
5934 | 5937 | # ensure that all processes which hold a reference to a |
|
0 commit comments