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 from upstream-pr/1082 into main
syntaxixr commented 2026-11-24 18:04:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by syntaxixr on 2026-11-24T18:04:13Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5477637258 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1082). Originally posted by [syntaxixr](https://github.com/syntaxixr) on 2026-11-24T18:04:13Z. --- 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 commented 2026-11-24 18:49:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T18:49:55Z.

Review: APPROVED


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6045339676 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1082#pullrequestreview-6045339676). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T18:49:55Z. **Review:** APPROVED --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by syntaxixr on 2026-11-24T19:08:17Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7141654467 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1082#issuecomment-7141654467). Originally posted by [syntaxixr](https://github.com/syntaxixr) on 2026-11-24T19:08:17Z. --- 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.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1082
No description provided.