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

Closed
github-bot wants to merge 1 commit from gh-pr/1082/head into gh-pr/1082/base
Owner

@⁠syntaxixr on GitHub · 2026-11-24 18:04 UTC · original
syntaxixr:tests/guest-scene-locale → main · +3 −1 · 1 files · 1 commits · closed without merging

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

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.

**@⁠syntaxixr** on GitHub · 2026-11-24 18:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1082) `syntaxixr:tests/guest-scene-locale` → `main` · +3 −1 · 1 files · 1 commits · closed without merging Claimed in the coordination issue as: TEST-GUEST-SCENE-LOCALE (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14). ## 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.
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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:37:04 +00:00
github-bot closed this pull request 2026-11-26 09:37:04 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 18:49 UTC · original · approved these changes

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.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1082#pullrequestreview-6045339676) · **approved these changes** 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.
Author
Owner

@⁠syntaxixr on GitHub · 2026-11-24 19:08 UTC · original

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** on GitHub · 2026-11-24 19:08 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1082#issuecomment-7141654467) 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

This discussion has been locked. Commenting is limited to contributors.
No description provided.