Skip to content

tests/test_guest_scene_reference: decode the launch-failure output with errors=replace (TEST-GUEST-SCENE-LOCALE) - #1082

Closed
syntaxixr wants to merge 1 commit into
ProjectLeonida:mainfrom
syntaxixr:tests/guest-scene-locale
Closed

syntaxixr wants to merge 1 commit into
ProjectLeonida:mainfrom
syntaxixr:tests/guest-scene-locale

Conversation

@syntaxixr

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: TEST-GUEST-SCENE-LOCALE (#14 (comment)).

Problem

test_launch_failure_preserves_run_record_and_logs decodes scripts/run_guest_scene.py's output as strict UTF-8. When the runner fails to launch, the error it prints includes the OS message, and on a non-English Windows that message is in the console's ANSI code page. On Russian Windows 10 (19045) the bytes are cp1251 ([WinError 216] \xdd\xf2\xe0 \xe2\xe5\xf0\xf1\xe8\xff "%1" ..., i.e. Эта версия "%1" ...), so subprocess.run raises UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdd in its reader thread before any assertion runs. CI runs on English Windows, which is why it doesn't show there.

Fix

Decode with errors="replace", as the test just above (line 95) already does. The assertions only read the return code and the JSON files the runner writes, so nothing they check changes.

Tested

Windows 10 22H2 (19045), Russian locale, Python 3.12.5:

  • python -I tests/test_guest_scene_reference.py: main gives FAILED (errors=1) (UnicodeDecodeError); this branch gives OK.

Test only, no game files. AI-assisted.

…th errors=replace (TEST-GUEST-SCENE-LOCALE)

On a non-English Windows the runner's launch error carries the OS message in
the ANSI code page (cp1251 on Russian Windows 10), so strict UTF-8 decoding
raised UnicodeDecodeError before any assertion. The test above it already
decodes with errors=replace.

@abnalstlll-byte abnalstlll-byte 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.

Reviewed and verified. Resolves UnicodeDecodeError on non-English Windows hosts by decoding child process failure logs with errors=replace in tests/test_guest_scene_reference.py. 100% clean-room.

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 24, 2026
@syntaxixr

Copy link
Copy Markdown
Contributor Author

Superseded by #586 (merged at 18:18 UTC), which makes the same errors="replace" change at the same line in tests/test_guest_scene_reference.py. That is why this PR now conflicts with main, so I'm closing it. Thanks @abnalstlll-byte for the review.

@syntaxixr syntaxixr closed this Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants