Fix Windows-only test failure: VRT path error uses non-repr format#1703
Merged
Conversation
The ValueError emitted by parse_vrt for paths outside the VRT
directory used {filename!r} and {vrt_root!r}, which on Windows
renders backslashes as doubled escapes (C:\\\\Users\\\\...). That
broke test_error_message_names_rejected_path on the windows-latest
runner since the assertion compares against the raw os.path.realpath
output. The same doubled-escape output is also user-hostile on
Windows.
Switch to explicit single-quote interpolation for filename and
vrt_root so the rendered path uses single backslashes. allowed_roots
stays as !r since it is a list, and the list-of-strings repr is
fine cross-platform.
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.
Closes #1702.
Summary
test_error_message_names_rejected_pathis failing onwindows-latest, 3.12(the rest of the Windows/macOS matrix is being cancelled via fail-fast). Main has been red since #1679 merged.The ValueError emitted by
parse_vrtfor paths outside the VRT directory used{filename!r}and{vrt_root!r}, which renders Windows paths with doubled backslashes (`C:\\Users\\...`). The test compares against the raw `os.path.realpath` output (single backslashes), so the substring match fails. The doubled output is also user-hostile on Windows.This switches to explicit single-quote interpolation for
filenameandvrt_root. `allowed_roots` stays as!rsince it is a list and the list-of-strings repr is fine cross-platform.Test plan
test_vrt_path_containment_1671.pypass on POSIX with the fix.windows-latestgoes green.