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

Closed
leonida/mandy
syntaxixr wants to merge 0 commits from tests/guest-scene-locale into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

syntaxixr commented 2026-11-24 18:04:13 +00:00

Claimed in the coordination issue as: TEST-GUEST-SCENE-LOCALE (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140102942).

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.

Claimed in the coordination issue as: TEST-GUEST-SCENE-LOCALE (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140102942). ## 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.
abnalstlll-byte approved these changes 2026-11-24 18:49:55 +00:00
abnalstlll-byte left a comment

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.

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.
syntaxixr commented 2026-11-24 19:08:17 +00:00

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.

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.
Sign in to join this conversation.
No description provided.