Repository navigation
tests: pass the no-game Python tests on Windows with a non-ASCII profile path - #2984
lines9686-rgb wants to merge 7 commits into
Conversation
…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>
|
Code read of 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>
|
Code read of My profile path is ASCII, so I pointed
Ran on Windows 11, Python 3.14 (ANSI cp1252, OEM 850): the 13 touched test files with the accented 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>
|
Thanks for the reproduction, @iurysf. The OEM point is in 14acb49: |
|
Re-checked 14acb49 (Windows 11, Python 3.14, ANSI cp1252 / OEM 850): with 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>
|
Tested 62d8694 on CPU (Windows 10, Python 3.11.3, cp1252 locale, no game files): pass. Ran all 11 modified stdlib test files (
Code read note: the (AI-assisted review/testing.) |
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: itstext=Trueread of the SPIRV-Tools program died in the reader thread on UTF-8 output and printed a traceback instead of its oneERRORline;errors="replace".tools/hw_oracle/runner.pyhad 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):MacVolumeTestspatchedsys.platformandos.pathconfbut kept Windows'os.path.normcase, which lowercases; the darwin patch now usesposixpath.normcasetoo.test_audio_wav,test_audio_stage_resume: the fakeffmpeg.cmdwas written in UTF-8, cmd.exe decodes a batch file with the OEM code page. Both now calltests/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 (stdoutwasNone);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 witherrors="replace"; on Linux that is UTF-8 as before.test_spirv_metal_set0_extra: its subprocess stubs now take theerrors=argument. The first push of this branch broke it; fixed in 511732b.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/Fofolder 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'stext=Trueruns 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):
test_text_write_line_endingsandcompileallOK;test_user_sgpr_censusunder pytest 9.2 (34 passed).tests/test_*.pywith 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 twovk_pipeline_checkskips).No GPU or game files. AI-assisted (Claude Code).
🤖 Generated with Claude Code