tests: expect the unreadable path as OSError prints it (bink_names, opus_tags, world_names) #312

Closed
github-bot wants to merge 1 commit from gh-pr/312/head into gh-pr/312/base
Owner

@⁠Andretuta on GitHub · 2026-11-24 03:06 UTC · original
ubiquitarianism:old-pr/10046 → main · +6 −3 · 3 files · 1 commits · closed without merging

Carried over from old PR 10046 by icecreammule277-dot in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10046, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
icecreammule277-dot: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Claimed in the coordination issue as: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7117092144 (test fix, no ID assigned)

Depends on: none.

What and why

tests/test_bink_names.py, tests/test_opus_tags.py and tests/test_world_names.py each make the tree walk report an unreadable folder (onerror(PermissionError(13, ..., blocked))) and assert that the folder's path appears in the tool's error message. That message embeds str(OSError), and OSError.__str__ prints the filename with repr(). On Windows a path has backslashes, so the message holds 'C:\\Users\\...' and assertIn(blocked, message) misses it. All three fail on main with the same shape, e.g. "'C:\Users\...\blocked' not found in "opus_tags: error: [Errno 13] Permission denied: 'C:\\Users\\...\\blocked'"".

Each assertion now expects repr(blocked), which is exactly the text OSError produces. On POSIX paths hold no backslashes or quotes, so repr(blocked) is just the quoted path and the check is as strict as before. Test only; no tool change.

Tested

Windows 11 (10.0.26300), CPython 3.15.2, no GPU or game files, on main de4c37383:

test main this branch
tests/test_bink_names.py FAIL (1) OK
tests/test_opus_tags.py FAIL (1) OK
tests/test_world_names.py FAIL (1) OK

I did not run a POSIX interpreter; the POSIX equivalence above is by reading OSError.__str__, not by a run.

AI-assisted: yes (Claude Code, Claude Sonnet 5.5).

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. (n/a: test only)
**@⁠Andretuta** on GitHub · 2026-11-24 03:06 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/312) `ubiquitarianism:old-pr/10046` → `main` · +6 −3 · 3 files · 1 commits · closed without merging > Carried over from **old PR 10046** by `icecreammule277-dot` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10046`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `icecreammule277-dot`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Claimed in the coordination issue as: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7117092144 (test fix, no ID assigned) Depends on: none. ### What and why `tests/test_bink_names.py`, `tests/test_opus_tags.py` and `tests/test_world_names.py` each make the tree walk report an unreadable folder (`onerror(PermissionError(13, ..., blocked))`) and assert that the folder's path appears in the tool's error message. That message embeds `str(OSError)`, and `OSError.__str__` prints the filename with `repr()`. On Windows a path has backslashes, so the message holds `'C:\\Users\\...'` and `assertIn(blocked, message)` misses it. All three fail on `main` with the same shape, e.g. "`'C:\Users\...\blocked' not found in "opus_tags: error: [Errno 13] Permission denied: 'C:\\Users\\...\\blocked'"`". Each assertion now expects `repr(blocked)`, which is exactly the text `OSError` produces. On POSIX paths hold no backslashes or quotes, so `repr(blocked)` is just the quoted path and the check is as strict as before. Test only; no tool change. ### Tested Windows 11 (10.0.26300), CPython 3.15.2, no GPU or game files, on `main` de4c37383: | test | `main` | this branch | |---|---|---| | `tests/test_bink_names.py` | FAIL (1) | OK | | `tests/test_opus_tags.py` | FAIL (1) | OK | | `tests/test_world_names.py` | FAIL (1) | OK | I did not run a POSIX interpreter; the POSIX equivalence above is by reading `OSError.__str__`, not by a run. AI-assisted: yes (Claude Code, Claude Sonnet 5.5). ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: test only)
Each test makes the tree walk report an unreadable folder and asserts the
folder's path appears in the tool's error message. The message embeds
str(OSError), which prints the filename with repr(), so on Windows every
backslash is doubled and assertIn(path, message) misses. Expect repr(path),
which is the text OSError produces; on POSIX the two are identical.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:53:00 +00:00
github-bot closed this pull request 2026-11-26 08:53:00 +00:00
Author
Owner

@⁠Dezmonius on GitHub · 2026-11-24 07:30 UTC · original

Independent Windows check of this draft (e29f8f0) against current main (d42773d). The three-file PR diff still passes git apply --check. I ran all three test files with the current tools, before and after applying the draft's assertion changes.

Test file Current main Main with this fix
test_bink_names.py 35/36 36/36
test_opus_tags.py 27/28 28/28
test_world_names.py 30/31 31/31

The result was identical on CPython 3.12.10 and 3.14.7. Each baseline failure is the targeted unreadable-directory assertion. With the change, all 95 tests pass on both interpreters, including the checks that an existing report or dictionary is preserved. The draft is still relevant to current main.

Synthetic inputs only, CPU-only. AI-assisted (Codex).

**@⁠Dezmonius** on GitHub · 2026-11-24 07:30 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/312#issuecomment-7125060709) Independent Windows check of this draft (`e29f8f0`) against current `main` (`d42773d`). The three-file PR diff still passes `git apply --check`. I ran all three test files with the current tools, before and after applying the draft's assertion changes. | Test file | Current main | Main with this fix | | --- | --- | --- | | `test_bink_names.py` | 35/36 | 36/36 | | `test_opus_tags.py` | 27/28 | 28/28 | | `test_world_names.py` | 30/31 | 31/31 | The result was identical on CPython 3.12.10 and 3.14.7. Each baseline failure is the targeted unreadable-directory assertion. With the change, all 95 tests pass on both interpreters, including the checks that an existing report or dictionary is preserved. The draft is still relevant to current main. Synthetic inputs only, CPU-only. AI-assisted (Codex).
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-24 19:50 UTC · original

Thanks for carrying this over, and to icecreammule277-dot for the original fix.

  • We are closing this in favour of #128, which fixes the same three Windows failures in the tools rather than the tests.
  • With #128, users on Windows see the path as they typed it (C:\...\blocked) rather than the repr'd 'C:\\...\\blocked'.
  • The two can't both land: with #128's tools, the repr(blocked) assertions here fail on Windows.
  • The copy of this change in #763 was closed for the same reason.
  • Thanks also to Dezmonius for the Windows check. It confirmed the diagnosis that #128 builds on.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-24 19:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/312#issuecomment-7142659197) Thanks for carrying this over, and to `icecreammule277-dot` for the original fix. - We are closing this in favour of #128, which fixes the same three Windows failures in the tools rather than the tests. - With #128, users on Windows see the path as they typed it (`C:\...\blocked`) rather than the repr'd `'C:\\...\\blocked'`. - The two can't both land: with #128's tools, the `repr(blocked)` assertions here fail on Windows. - The copy of this change in #763 was closed for the same reason. - Thanks also to Dezmonius for the Windows check. It confirmed the diagnosis that #128 builds on. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.