Fix Windows tempdir cleanup race in test_vrt_tiled_scheduler_1714#1748
Merged
Conversation
Threaded dask writes can leave file handles briefly open after the context manager exits, so Windows raises PermissionError [WinError 32] on the recursive directory removal. Linux closes the handles before shutil.rmtree walks the tree, so it never fails there. Pass ignore_cleanup_errors=True on each TemporaryDirectory. The tests verify the writes succeeded before the context exits, so the cleanup failure is purely a Windows-side temp-file leak, not a real bug.
brendancol
added a commit
that referenced
this pull request
May 12, 2026
The new test cases on this PR write a source TIFF inside a TemporaryDirectory before invoking read_vrt. On Windows the read path can leave a file handle open just past the context exit, so shutil.rmtree raises WinError 32 (same shape as #1748). Linux closes in time and never trips. ignore_cleanup_errors=True keeps the cleanup best-effort. The assertions still run inside the context so a real failure still fails the test; only the tempdir teardown is now tolerant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test_vrt_tiled_scheduler_1714.pyfails on Windows runners withPermissionError [WinError 32]because the threaded dask writer leaves file handles briefly open after theTemporaryDirectorycontext exits.ignore_cleanup_errors=Trueon eachTemporaryDirectoryso the recursive removal swallows the lingering handle and the directory is best-effort cleaned.Test plan
pytest xrspatial/geotiff/tests/test_vrt_tiled_scheduler_1714.py -vpasses locally on Linux.