Skip to content

Commit 0fa97c8

Browse files
committed
Run GC in test support _unlink amd _rmdir on Windows to make sure all handles are closed
1 parent 676d93f commit 0fa97c8

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

graalpython/lib-python/3/test/support/os_helper.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ def unlink(filename):
332332

333333
if sys.platform.startswith("win"):
334334
def _waitfor(func, pathname, waitall=False):
335+
# GraalPy change: run GC to ensure all handles are closed
336+
support.gc_collect()
335337
# Perform the operation
336338
func(pathname)
337339
# Now setup the wait loop
@@ -348,7 +350,9 @@ def _waitfor(func, pathname, waitall=False):
348350
# required when contention occurs.
349351
timeout = 0.001
350352
# GraalPy change: increase timeout to account for our overloaded machines
353+
# and run GC to ensure all handles are closed
351354
while timeout < 120.0:
355+
support.gc_collect()
352356
# Note we are only testing for the existence of the file(s) in
353357
# the contents of the directory regardless of any security or
354358
# access rights. If we have made it this far, we have sufficient

0 commit comments

Comments
 (0)