Skip to content

Fix Windows-only test failure: VRT path error uses non-repr format#1703

Merged
brendancol merged 1 commit into
mainfrom
fix-vrt-msg-windows-1671
May 12, 2026
Merged

Fix Windows-only test failure: VRT path error uses non-repr format#1703
brendancol merged 1 commit into
mainfrom
fix-vrt-msg-windows-1671

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Closes #1702.

Summary

test_error_message_names_rejected_path is failing on windows-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_vrt for 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 filename and vrt_root. `allowed_roots` stays as !r since it is a list and the list-of-strings repr is fine cross-platform.

Test plan

  • All 10 tests in test_vrt_path_containment_1671.py pass on POSIX with the fix.
  • CI on windows-latest goes green.
  • User-facing error message reads cleanly on Windows.

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.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 12, 2026
@brendancol brendancol merged commit eb7fa50 into main May 12, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: test_error_message_names_rejected_path fails on main due to repr backslash escapes

1 participant