Skip to content

tests: match the path as the error message prints it on Windows - #69

Closed
wavehs wants to merge 1 commit into
ProjectLeonida:mainfrom
wavehs:tests-win-error-path-repr
Closed

wavehs wants to merge 1 commit into
ProjectLeonida:mainfrom
wavehs:tests-win-error-path-repr

Conversation

@wavehs

@wavehs wavehs commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: none — the original project's coordination issue was lost with its repository, and this repository's issue index (#18) has no entry for these. No open pull request touches these three files.

Depends on: none.

What and why

The Windows check job collects every failing file, and three of them fail for one reason: OSError.__str__ prints the filename with %r, so on Windows each backslash in the message is doubled.

FAIL: test_unreadable_mount_directory_preserves_the_report (tests/test_bink_names.py:340)
AssertionError: 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpdb9s4_zi\\mount\\blocked' not found in
              "bink_names: error: [Errno 13] permission denied: 'C:\\\\Users\\\\RUNNER~1\\\\AppData\\\\Local\\\\Temp\\\\tmpdb9s4_zi\\\\mount\\\\blocked'\n"

The same assertion in tests/test_world_names.py:49 and tests/test_opus_tags.py:337 fails the same way. On POSIX there is nothing to escape, which is why these only fail on Windows. The tests now compare repr(blocked), which is exactly what the tool prints — the product's message is Python's own and is right.

Tested

macOS 15 arm64 (Apple M3 Pro), CPython 3.15.2; no game files.

  • All three files: OK here, before and after (the escaping only happens on Windows).
  • The failing shape is reproduced by building the same PermissionError from a Windows path:
    blocked in message → False, repr(blocked) in message → True.
  • The Windows failure itself is the check job log quoted above (9ec34cdff, run 45306800350, job 138157329747) — I have no Windows host to re-run it on.

compileall clean, check_no_game_data.py clean. Not run: Windows, any GPU test.

AI-assisted: yes.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: test-only.)

OSError.__str__ formats the filename with %r, so on Windows every backslash
is doubled: the message holds C:\\Users\\... where the tempfile path is
C:\Users\.... three tests asserted the raw path with assertIn and failed on
Windows only ('not found in "ERROR: [Errno 13] Permission denied:
C:\\\\Users..."'), which is how the check job keeps three files red.
@wavehs

wavehs commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favour of a decision between the two preserved approaches to the same three failing assertions:

They conflict: if #128 lands, the messages lose the doubled backslashes and the tests have to keep asserting the raw path, so merging both would leave one side wrong. Whoever merges #128 should just drop this; if 10046 is preferred instead, this is the same change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant