[PR #586] [MERGED] tests: guest scene launch failure decodes a localized OS error (TEST-GSR-LOCALE) #628

Closed
opened 2026-11-26 20:18:31 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/586
Author: @kawaii-shakal
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @aslan2142

Base: main ← Head: test-gsr-locale


📝 Commits (1)

  • 0667ec1 tests: guest scene launch failure decodes a localized OS error (TEST-GSR-LOCALE)

📊 Changes

1 file changed (+3 additions, -1 deletions)

View changed files

📝 tests/test_guest_scene_reference.py (+3 -1)

📄 Description

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_logs on adjacent lines, so git merge-tree reports 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_logs fails on a Windows host whose ANSI code page is not UTF-8 (1251 on a Russian install).

scripts/run_guest_scene.py reports the failed launch as FAIL: 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 no errors=). The decode fails in subprocess's reader thread, result.stdout comes back as None, and the next line (result.stdout + result.stderr in the assertion message) raises TypeError before any of the test's real assertions run. pytest also reports a PytestUnhandledThreadExceptionWarning with UnicodeDecodeError: '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 read report.json and logs/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.
  • Same file with PYTHONUTF8=1 (what a UTF-8 host sees): 6 passed.
  • Negative control: with the change stashed, the test fails again with the TypeError above.
  • Whole suite outside the translator, 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 (#128, #312), test_tool_stdout_encoding (#367), test_user_sgpr_census[folding-volume-case] (#368, #490).
  • python -I scripts/check_no_game_data.py tests/test_guest_scene_reference.py and python -m compileall clean.

GPUs tested: n/a (no GPU or game files involved)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/586 **Author:** [@kawaii-shakal](https://github.com/kawaii-shakal) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `test-gsr-locale` --- ### 📝 Commits (1) - [`0667ec1`](https://github.com/ubiquitarianism/leonida/commit/0667ec19ebc673545dd9e950a5f0d6ee455ccba3) tests: guest scene launch failure decodes a localized OS error (TEST-GSR-LOCALE) ### 📊 Changes **1 file changed** (+3 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_guest_scene_reference.py` (+3 -1) </details> ### 📄 Description Claimed in the coordination issue as: TEST-GSR-LOCALE ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7126627432)) Depends on: #320 — no code dependency, but both change `test_launch_failure_preserves_run_record_and_logs` on adjacent lines, so `git merge-tree` reports 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_logs` fails on a Windows host whose ANSI code page is not UTF-8 (1251 on a Russian install). `scripts/run_guest_scene.py` reports the failed launch as `FAIL: 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 no `errors=`). The decode fails in `subprocess`'s reader thread, `result.stdout` comes back as `None`, and the next line (`result.stdout + result.stderr` in the assertion message) raises `TypeError` before any of the test's real assertions run. pytest also reports a `PytestUnhandledThreadExceptionWarning` with `UnicodeDecodeError: '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 read `report.json` and `logs/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. - Same file with `PYTHONUTF8=1` (what a UTF-8 host sees): 6 passed. - Negative control: with the change stashed, the test fails again with the `TypeError` above. - Whole suite outside the translator, `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` (#128, #312), `test_tool_stdout_encoding` (#367), `test_user_sgpr_census[folding-volume-case]` (#368, #490). - `python -I scripts/check_no_game_data.py tests/test_guest_scene_reference.py` and `python -m compileall` clean. GPUs tested: n/a (no GPU or game files involved) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:31 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#628
No description provided.