Repository navigation
tests: guest scene launch failure decodes a localized OS error (TEST-GSR-LOCALE) - #586
Merged
Merged
Conversation
…GSR-LOCALE) On a Windows host whose ANSI code page is not UTF-8 (1251 on a Russian install), run_guest_scene.py prints the "could not launch" line with the localized [WinError 216] text in that code page. The test decoded the child's output as strict UTF-8, so subprocess.run left result.stdout as None and the next line failed with a TypeError before any real assertion ran. Decode with errors="replace", as the output-directory case in the same file already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lixonik
reviewed
Nov 24, 2026
lixonik
left a comment
Contributor
There was a problem hiding this comment.
Independent verification of 0667ec1 with a synthetic Windows fixture: I ran test_launch_failure_preserves_run_record_and_logs with the temporary directory under a path containing a non-ASCII character. On the comparison base the subprocess reader raised UnicodeDecodeError, then the assertion message raised TypeError. On the PR head the same case passed. The ordinary test file passed all six tests on both revisions.
This exercises the same decoder failure through a non-ASCII path in the launch diagnostic. AI-assisted testing.
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: TEST-GSR-LOCALE (claim)
Depends on: #320 — no code dependency, but both change
test_launch_failure_preserves_run_record_and_logson adjacent lines, sogit merge-treereports a textual conflict; whichever lands second needs a one-line rebase.What and why
tests/test_guest_scene_reference.py::test_launch_failure_preserves_run_record_and_logsfails on a Windows host whose ANSI code page is not UTF-8 (1251 on a Russian install).scripts/run_guest_scene.pyreports the failed launch asFAIL: full: could not launch <loader>: [WinError 216] ..., and Windows localizes that OS error text. The child writes it to the pipe in the ANSI code page, while the test decoded the output as strict UTF-8 (encoding="utf-8"with noerrors=). The decode fails insubprocess's reader thread,result.stdoutcomes back asNone, and the next line (result.stdout + result.stderrin the assertion message) raisesTypeErrorbefore any of the test's real assertions run. pytest also reports aPytestUnhandledThreadExceptionWarningwithUnicodeDecodeError: 'utf-8' codec can't decode byte 0xdd.The fix decodes with
errors="replace", as the output-directory case in the same file (line 95) already does. Stdout is only used for the failure message here; the test's assertions readreport.jsonandlogs/full.json, which the runner writes as UTF-8. No tool change.Tested
Windows 11 Pro 26300, ANSI code page 1251, Python 3.13.13, pytest 9.2.0 from
tests/requirements.txt:python -m pytest tests/test_guest_scene_reference.py: 6 passed (was 1 failed, 5 passed).python -I tests/test_guest_scene_reference.py: 6 tests OK.PYTHONUTF8=1(what a UTF-8 host sees): 6 passed.TypeErrorabove.python -m pytest tests --ignore=tests/semantic: 5 failed, 8695 passed, 1011 skipped (before: 6 failed, 8694 passed). The 5 remaining failures are other Windows issues already covered by open pull requests:test_bink_names,test_opus_tags,test_world_names(tools: print the plain path, not a repr'd one, in OSError messages #128, tests: expect the unreadable path as OSError prints it (bink_names, opus_tags, world_names) #312),test_tool_stdout_encoding(pr_conflict_label: guard stdout against the console code page (TEST-WIN-SWEEP) #367),test_user_sgpr_census[folding-volume-case](tests: sgpr census folding-volume case survives Windows realpath case (TEST-WIN-SWEEP) #368, report_paths: respect case-sensitive Windows directories (OLD-9412) #490).python -I scripts/check_no_game_data.py tests/test_guest_scene_reference.pyandpython -m compileallclean.GPUs tested: n/a (no GPU or game files involved)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code