Skip to content

tests: pass the no-game Python tests on Windows with a non-ASCII profile path - #2984

Open
lines9686-rgb wants to merge 7 commits into
ItsNotRexed:mainfrom
lines9686-rgb:test-windows-nonascii
Open

lines9686-rgb wants to merge 7 commits into
ItsNotRexed:mainfrom
lines9686-rgb:test-windows-nonascii

Conversation

@lines9686-rgb

@lines9686-rgb lines9686-rgb commented Nov 22, 2026 •

Copy link
Copy Markdown

Item: new TEST item, claimed in #2891 (#2891 (comment)).

Linux CI runs these files; the Windows job runs only a few, so on Windows they fail unnoticed (main, Windows 11, a user profile whose folder name has Cyrillic letters, the temp folder inside it).

Tool

  • tools/spirv_metal_set0.py: its text=True read of the SPIRV-Tools program died in the reader thread on UTF-8 output and printed a traceback instead of its one ERROR line; errors="replace".
  • tools/hw_oracle/runner.py had the same kind of bug (the vcvars script written as ASCII). hw_oracle: the vcvars build script survives paths outside ASCII #2667 fixed it on main while this was open, so this branch now takes main's version; see "hw_oracle tests" below.

Tests

  • test_report_paths (any Windows): MacVolumeTests patched sys.platform and os.pathconf but kept Windows' os.path.normcase, which lowercases; the darwin patch now uses posixpath.normcase too.
  • test_audio_wav, test_audio_stage_resume: the fake ffmpeg.cmd was written in UTF-8, cmd.exe decodes a batch file with the OEM code page. Both now call tests/winbatch.py (8.3 short names, OEM code page), shared per review.
  • test_make_game_submodule: git's UTF-8 output decoded with the ANSI code page killed the reader thread (stdout was None); errors="replace".
  • test_spirv_metal_set0_cli_errors, test_user_sgpr_census, test_anim_index, test_awc_manifest, test_gamedata_graph, test_manifest_verifier, test_world_build: they decoded the Python child's output as UTF-8, but the tools write in the locale encoding (the ANSI code page on Windows), so a non-ASCII temp path never matched (test_awc_manifest's reader thread died). They now read it in the locale encoding with errors="replace"; on Linux that is UTF-8 as before.
  • test_spirv_metal_set0_extra: its subprocess stubs now take the errors= argument. The first push of this branch broke it; fixed in 511732b.
  • hw_oracle tests: two of hw_oracle: the vcvars build script survives paths outside ASCII #2667's tests (VcvarsScript.test_ascii_paths_give_the_same_commands_as_before, Unavailable.test_host_compiler_commands) decoded the now-UTF-8 vcvars script as ASCII; the /Fo folder is in %TEMP%, so they fail when the user name isn't ASCII. They decode it as UTF-8.

Checked, not changed: make_game.py's text=True runs of Python children read the child's own ANSI output, so they don't hit this.

Tested

Windows 11 (26200), Python 3.12, user profile with Cyrillic letters, after merging main (51a6fee):

  • on main: the tests above fail;
  • with this branch, every file above passes with TEMP inside the profile (non-ASCII) and with an ASCII TEMP; test_text_write_line_endings and compileall OK; test_user_sgpr_census under pytest 9.2 (34 passed).
  • A full run of all tests/test_*.py with the Cyrillic TEMP before the merge left no failure from a non-ASCII path (the remaining ones were pytest-only files run as scripts and the two vk_pipeline_check skips).

No GPU or game files. AI-assisted (Claude Code).

🤖 Generated with Claude Code

…ile path

Five tests that only the Linux CI runs fail on Windows:

- test_report_paths: the darwin patch kept Windows' os.path.normcase,
  which lowercases; use posixpath.normcase there too.
- test_audio_wav, test_audio_stage_resume: cmd.exe decodes the fake
  ffmpeg.cmd with the OEM code page, not UTF-8; write non-ASCII paths as
  their 8.3 short names, the file in the OEM code page.
- test_make_game_submodule, tools/spirv_metal_set0.py: text=True decodes
  UTF-8 child output with the ANSI code page and the reader thread dies;
  errors="replace".
- test_spirv_metal_set0_cli_errors: read the Python child's stderr in the
  locale encoding it writes, not UTF-8.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tupacfan04

Copy link
Copy Markdown
Contributor

Code read of a9f7e3e9 (I didn't run it). Looks right. cmd.exe decodes a batch file in the OEM code page, so a UTF-8 path with Cyrillic letters can't be found. Writing the .cmd in "oem" and using the 8.3 short name for non-ASCII paths fixes it. Falling back to the long path when GetShortPathNameW gives nothing (8.3 names disabled) keeps it from getting worse. One small simplification: the same batch_path helper is now defined in two test files (_batch_path and batch_path), so moving it into a shared test helper would keep the two from diverging.

AI-assisted review (Claude Code).

…atch.py)

Review suggestion on ItsNotRexed#2984: test_audio_wav and test_audio_stage_resume each
had their own copy of the 8.3-short-name helper. Both now call
winbatch.write_python_cmd, so the two can't diverge.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ad child output right

A full run with the temp folder in a profile named in Cyrillic found:

- tools/hw_oracle/runner.py wrote build_hw_oracle.cmd with encoding
  "ascii", so any non-ASCII path (the temp work folder, Visual Studio,
  the source) raised UnicodeEncodeError before hw_oracle compiled
  anything. Non-ASCII paths now go in as their 8.3 short names, the file
  in the OEM code page cmd.exe reads it with (UTF-8 elsewhere). New check
  in test_hw_oracle: a work folder named "Пользователь".
- test_spirv_metal_set0_extra: its subprocess stubs didn't take the
  errors= argument this branch added to tools/spirv_metal_set0.py.
- test_user_sgpr_census, test_anim_index, test_awc_manifest,
  test_gamedata_graph, test_manifest_verifier, test_world_build: they
  decoded the Python child's output as UTF-8, but the tool writes in the
  locale encoding (the ANSI code page on Windows), so a non-ASCII temp
  path never matched; test_awc_manifest's reader thread died (no errors=).

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hw_oracle's vcvars script is fixed on main by ItsNotRexed#2667 (UTF-8 + chcp 65001), so this
branch takes main's runner.py and drops its own 8.3-name version. Two of main's
new hw_oracle tests decoded that UTF-8 script as ASCII, which fails when %TEMP%
holds a non-ASCII user name; they now decode it as UTF-8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@iurysf

iurysf commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Code read of 51a6feec, with a reproduction: looks good.

My profile path is ASCII, so I pointed TEMP/TMP at a folder named pasta_ação (representable in both cp1252 and
OEM 850, like an accented user name; that folder has no 8.3 name, so winbatch's "oem" fallback was exercised too).
With current main f847748c, 11 of the 13 touched test files fail there: anim_index 2, audio_stage_resume 1 error,
audio_wav 4 (can't open file '…pasta_a├º├úo…\fake_ffmpeg.py', the UTF-8 .cmd read in OEM), awc_manifest 6 errors,
gamedata_graph 1, hw_oracle 2 errors, manifest_verifier 4, report_paths 1, spirv_metal_set0_cli_errors 2,
user_sgpr_census 9, world_build 14. At this head all 13 pass, and they still pass with an ASCII TEMP.

  • Reading a piped Python child with the locale encoding instead of encoding="utf-8" is right: the child writes the
    ANSI code page on Windows (UTF-8 on Linux or in UTF-8 mode), so parent and child agree.
  • Small: in tests/winbatch.py's no-8.3 fallback, a path with letters outside the OEM code page (Cyrillic on a cp850
    machine with 8.3 names off) makes open(…, encoding="oem") raise UnicodeEncodeError mid-test. cmd.exe couldn't run
    that file anyway, so a skipTest with the reason would say what's going on.
  • The test_make_game_submodule change (errors="replace" on git's output) didn't show up in this reproduction (the
    test also passes on main with the accented TEMP). It needs a repository path outside the ANSI page. The code
    looks right; I just couldn't demonstrate it here.

Ran on Windows 11, Python 3.14 (ANSI cp1252, OEM 850): the 13 touched test files with the accented TEMP, on main and
at this head (pytest for test_user_sgpr_census.py).

AI-assisted code read (Claude).

Review of ItsNotRexed#2984 (@iurysf): with 8.3 names off, a path with letters outside the
OEM code page made open(..., encoding="oem") raise UnicodeEncodeError mid-test.
cmd.exe couldn't run that batch file in any encoding, so write_python_cmd now
raises unittest.SkipTest that names the letters (Windows' "oem" codec reports no
useful position, so they are found per character) and writes nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lines9686-rgb

Copy link
Copy Markdown
Author

Thanks for the reproduction, @iurysf. The OEM point is in 14acb49: write_python_cmd now raises unittest.SkipTest naming the letters (Windows' "oem" codec reports no useful position, so they are found per character) and writes no file. On test_make_game_submodule: here git prints the temp path in UTF-8 and one byte of that, 0x98, has no character in cp1251, so the reader thread dies; cp1252 decodes nearly every byte, just into the wrong characters, which is why it passes for you on main. AI-assisted (Claude Code).

@iurysf

iurysf commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Re-checked 14acb49 (Windows 11, Python 3.14, ANSI cp1252 / OEM 850): with TEMP/TMP pointing at a folder named pasta_ação the 13 touched test files pass (test_user_sgpr_census.py is pytest-based: 34 passed under pytest in a throwaway environment); test_audio_wav.py skips 17 here only because ffmpeg isn't on PATH. With a Cyrillic TEMP (outside both code pages), test_audio_stage_resume.py now skips with the reason instead of raising. In that same Cyrillic case test_anim_index.py (2 failures) and test_manifest_verifier.py (4) still fail, identically on main (they compare paths printed to stderr), so that's outside this PR.

AI-assisted code read (Claude).

test_report_paths' macOS normcase fix landed on main as f7c7d57; take main's
version of the file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main's 8599cfc starts build_hw_oracle.cmd from the work folder; keep its paths and
this branch's UTF-8 reads of the script (its /Fo folder is under %TEMP%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Codejustcode12

Codejustcode12 commented Nov 23, 2026 •

Copy link
Copy Markdown

Tested 62d8694 on CPU (Windows 10, Python 3.11.3, cp1252 locale, no game files): pass.

Ran all 11 modified stdlib test files (test_anim_index.py, test_audio_stage_resume.py, test_audio_wav.py, test_awc_manifest.py, test_gamedata_graph.py, test_hw_oracle.py, test_make_game_submodule.py, test_manifest_verifier.py, test_spirv_metal_set0_cli_errors.py, test_spirv_metal_set0_extra.py, test_world_build.py):

  • Baseline on origin/main (98fa503) with non-ASCII TEMP/TMP (tmp_café_über): 4/11 passed, 7/11 failed (37 failures/errors).
  • PR head 62d8694 with the same non-ASCII TEMP/TMP (tmp_café_über): 11/11 passed, 0 failed.
  • PR head 62d8694 with ASCII TEMP/TMP: 11/11 passed, 0 failed.
  • Guards (python -m compileall -q make_game.py tools tests, tests/test_ci_registration.py, tests/test_text_write_line_endings.py, scripts/check_no_game_data.py): all pass.

Code read note: the subprocess.run(..., text=True, errors="replace") change and tests/winbatch.py (GetShortPathNameW + OEM encoding with SkipTest fallback) look clean. Note (not a regression): when TEMP contains characters outside the active Windows ANSI code page (e.g. Vietnamese/Cyrillic on a cp1252 host), python -I escapes those characters in piped stderr (\uXXXX), so the 5 tests asserting literal path substrings still fail on out-of-codepage TEMP, while winbatch.py and the other 6 tests still pass. (test_user_sgpr_census.py was not run since pytest is not installed here.)

(AI-assisted review/testing.)

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.

4 participants