Skip to content

tests: expect the unreadable path as OSError prints it (bink_names, opus_tags, world_names) (OLD-10046) - #763

Closed
abnalstlll-byte wants to merge 1 commit into
ProjectLeonida:mainfrom
abnalstlll-byte:restore/old-10046-tests-oserror-repr
Closed

abnalstlll-byte wants to merge 1 commit into
ProjectLeonida:mainfrom
abnalstlll-byte:restore/old-10046-tests-oserror-repr

Conversation

@abnalstlll-byte

Copy link
Copy Markdown
Contributor

Carries old PR 10046 (draft #312, old-pr/10046 by @icecreammule277-dot), rebased cleanly on current main (2d73c24).

What this does

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 exact text OSError produces on Windows while remaining identical on POSIX.

Verification

  • python -I tests/test_world_names.py: 31/31 PASS (resolves Windows failure)
  • python -I tests/test_bink_names.py: 36/36 PASS (resolves Windows failure)
  • python -I tests/test_opus_tags.py: 28/28 PASS (resolves Windows failure)
  • python -I scripts/check_no_game_data.py: clean
  • Standard library only, no game data. AI-assisted.

…pus_tags, world_names)

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 <noreply@anthropic.com>

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent check from full Git worktrees at e04c4216 and 2d73c242. On Windows the base failed exactly the one unreadable-directory assertion in each of the three changed suites. The PR passed all 95 tests on Windows (36 Bink, 28 Opus, 31 world names). The same 95 also passed on Linux under local WSL, confirming the new repr assertions work on both platforms.

Commands used python -I -B on each of the three test files. AI-assisted testing with synthetic inputs. No game files or GPU used.

@nilparra-dev

Copy link
Copy Markdown

Measured conflict with #128 on native Windows 11, Python 3.13, clean worktrees (no game files, no GPU):

So the two approaches cannot both merge; whichever lands second turns the Windows leg red. Linux CI does not show it because repr() keeps POSIX paths unchanged. Full measurement and line references are in the finding on #14.

Recommendation: close this and #312 in favour of #128, which fixes the tool's error message instead of baking the doubled-backslash form into the tests. If the maintainers prefer the test-side fix, #128 should be closed instead; either way one of them needs to go.

AI-assisted.

@abnalstlll-byte

Copy link
Copy Markdown
Contributor Author

Closing in favour of #128.

Thank you @nilparra-dev and @levi2m for the thorough cross-PR Windows measurements (and @lixonik for checking Windows/WSL). Fixing the tool-side error formatting in #128 (error.filename / error.strerror) rather than hardcoding doubled-backslash repr() strings in the tests is indeed the cleaner solution and avoids keeping the conflict open.

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

Labels

missing claim Needs a claim in #14

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants