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

Closed
Andretuta wants to merge 1 commit from upstream-pr/312 into main
Andretuta commented 2026-11-24 03:06:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T03:06:58Z.


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)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465321390 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/312). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T03:06:58Z. --- > 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)
Dezmonius commented 2026-11-24 07:30:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Dezmonius on 2026-11-24T07:30:08Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7125060709 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/312#issuecomment-7125060709). Originally posted by [Dezmonius](https://github.com/Dezmonius) on 2026-11-24T07:30:08Z. --- 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).
aslan2142 commented 2026-11-24 19:50:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T19:50:17Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7142659197 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/312#issuecomment-7142659197). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-24T19:50:17Z. --- 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

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!312
No description provided.