[PR #1425] tests: assert the PermissionError filename as OSError renders it (TEST-WIN-PERMERR-REPR) #1455

Open
opened 2026-11-26 20:21:19 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1425
Author: @thiefyzheng
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/test-permerr-repr


📝 Commits (1)

  • 04b6b2e tests: assert the PermissionError filename as OSError renders it (TEST-WIN-PERMERR-REPR)

📊 Changes

3 files changed (+3 additions, -3 deletions)

View changed files

📝 tests/test_bink_names.py (+1 -1)
📝 tests/test_opus_tags.py (+1 -1)
📝 tests/test_world_names.py (+1 -1)

📄 Description

What

One line in each of three test files: self.assertIn(blocked, err.getvalue()) → self.assertIn(repr(blocked), err.getvalue()).

Why

The finding is @GTAVIB4GTAVI's (coordination issue #14, 23:34:10Z): the three unreadable-directory tests mock os.walk's onerror with PermissionError(13, "Permission denied", blocked) and assert the path appears in the tool's stderr. The tools print ERROR: {e} — tools/world_names.py:671, tools/bink_names.py:459, tools/opus_tags.py:278 — and str(OSError) renders .filename with repr(): quoted, backslashes doubled. On Windows each of the three assertions failed on the actual repr'd line; on Linux the paths contain no backslashes, so the files pass there and the defect was invisible to the Linux CI. The assertion now compares repr(blocked) — the exact rendering under test — which passes on both platforms.

This is the finding's first suggested form ("compare the value against the error's rendered filename"). Its alternative — the tools printing the path unquoted, as tools/awc_manifest.py:268 and tools/bink_index.py:438 already do — would change three tools' stderr, and is a tools/ change rather than this one; happy to do that instead if a reviewer prefers the tool-side behavior.

Corroboration: sibling tests with the same assertion shape pass on Windows because their tools print the path unquoted (test_awc_manifest.py:312 → tools/awc_manifest.py:268; test_bink_index.py:339), and test_awc_opus.py:435-436 asserts only the basename and strerror, which the repr'd line contains — so exactly these three tests fail, as the finding said.

What I ran

Windows 11 (Python 3.12.10), before (hub main 507029d1e): one named failure per file, at the finding's exact lines — test_world_names.py:49 (1 of 31), test_bink_names.py:340 (1 of 36), test_opus_tags.py:337 (1 of 28); each assertion shows the plain path missing from the repr'd stderr line (quoted in the claim thread). After: all three files OK — 31/36/28 tests. Linux (CPython 3.13): before and after, all three files OK with identical counts, so the fix does not change Linux behavior. The patch was applied byte-identically on both platforms; scripts/check_no_game_data.py clean.

Not run

Not run under the repo's full CI suites (workflows will cover these files on both platforms); the tool-side alternative was deliberately not implemented.

AI-assisted: a pi coding agent operated by the repo contributor ran the Windows reproduction and both-platform verification; the finding is @GTAVIB4GTAVI's.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1425 **Author:** [@thiefyzheng](https://github.com/thiefyzheng) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/test-permerr-repr` --- ### 📝 Commits (1) - [`04b6b2e`](https://github.com/ubiquitarianism/leonida/commit/04b6b2ee4a040359a5b9047ee5b7a2204e050eba) tests: assert the PermissionError filename as OSError renders it (TEST-WIN-PERMERR-REPR) ### 📊 Changes **3 files changed** (+3 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_bink_names.py` (+1 -1) 📝 `tests/test_opus_tags.py` (+1 -1) 📝 `tests/test_world_names.py` (+1 -1) </details> ### 📄 Description ## What One line in each of three test files: `self.assertIn(blocked, err.getvalue())` → `self.assertIn(repr(blocked), err.getvalue())`. ## Why The finding is @GTAVIB4GTAVI's (coordination issue #14, 23:34:10Z): the three unreadable-directory tests mock `os.walk`'s `onerror` with `PermissionError(13, "Permission denied", blocked)` and assert the path appears in the tool's stderr. The tools print `ERROR: {e}` — `tools/world_names.py:671`, `tools/bink_names.py:459`, `tools/opus_tags.py:278` — and `str(OSError)` renders `.filename` with `repr()`: quoted, backslashes doubled. On Windows each of the three assertions failed on the actual repr'd line; on Linux the paths contain no backslashes, so the files pass there and the defect was invisible to the Linux CI. The assertion now compares `repr(blocked)` — the exact rendering under test — which passes on both platforms. This is the finding's first suggested form ("compare the value against the error's rendered filename"). Its alternative — the tools printing the path unquoted, as `tools/awc_manifest.py:268` and `tools/bink_index.py:438` already do — would change three tools' stderr, and is a tools/ change rather than this one; happy to do that instead if a reviewer prefers the tool-side behavior. Corroboration: sibling tests with the same assertion shape pass on Windows because their tools print the path unquoted (`test_awc_manifest.py:312` → `tools/awc_manifest.py:268`; `test_bink_index.py:339`), and `test_awc_opus.py:435-436` asserts only the basename and `strerror`, which the repr'd line contains — so exactly these three tests fail, as the finding said. ## What I ran Windows 11 (Python 3.12.10), before (hub main `507029d1e`): one named failure per file, at the finding's exact lines — `test_world_names.py:49` (1 of 31), `test_bink_names.py:340` (1 of 36), `test_opus_tags.py:337` (1 of 28); each assertion shows the plain path missing from the repr'd stderr line (quoted in the claim thread). After: all three files OK — 31/36/28 tests. Linux (CPython 3.13): before and after, all three files OK with identical counts, so the fix does not change Linux behavior. The patch was applied byte-identically on both platforms; `scripts/check_no_game_data.py` clean. ## Not run Not run under the repo's full CI suites (workflows will cover these files on both platforms); the tool-side alternative was deliberately not implemented. **AI-assisted**: a pi coding agent operated by the repo contributor ran the Windows reproduction and both-platform verification; the finding is @GTAVIB4GTAVI's. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1455
No description provided.