tests: decode the GPU work-directory error as UTF-8 on non-English Windows (TEST-WINDOWS-ANSI-STDERR) #2112

Open
github-bot wants to merge 3 commits from github-bot/gh-2112 into main AGit
Owner

@⁠MoonEyes on GitHub · 2026-11-25 21:10 UTC · original
MoonEyes:fix/run-gpu-tests-ansi-stderr → main · +4 −2 · 1 files · 3 commits · open

Claimed in the coordination issue as: TEST-WINDOWS-ANSI-STDERR (#1608)

What and why

WorkDirectory.test_file_blocking_work_directory_is_a_cli_error in tests/test_run_gpu_tests_paths.py runs
scripts/run_gpu_tests.py with -I and asserts on its stderr. That stderr quotes a localized OS error
("Impossible de créer un fichier déjà existant" on a French install). -I ignores PYTHONUTF8, so the child
wrote the message in the ANSI code page (cp1252), while a parent running with PYTHONUTF8=1 decoded the pipe
as UTF-8. The reader thread raised UnicodeDecodeError, result.stderr came back None, and both subtests
(blocked_child='' and 'spirv') failed with a TypeError before their assertions ran.

The child now runs with -X utf8 (which -I keeps) and the parent decodes with encoding="utf-8", so both sides
agree whatever the host locale or PYTHONUTF8 setting. Decoding stays strict, so a real mismatch would still show.
Test-only change; scripts/run_gpu_tests.py is untouched.

Tested

Windows 11 (French, ANSI code page cp1252), Python 3.14.0, python -m pytest tests/test_run_gpu_tests_paths.py:

  • main, PYTHONUTF8=1: 2 subtests fail (UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9, then
    TypeError: argument of type 'NoneType' is not a container or iterable at line 145).
  • main, without PYTHONUTF8: passes.
  • this branch, PYTHONUTF8=1: 21 passed, 7 subtests passed.
  • this branch, without PYTHONUTF8: 21 passed, 7 subtests passed.

GPUs tested: n/a (the test uses stand-in tool files; no GPU runs)

AI-assisted: yes (Claude Code)

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)

🤖 Generated with Claude Code

**@⁠MoonEyes** on GitHub · 2026-11-25 21:10 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2112) `MoonEyes:fix/run-gpu-tests-ansi-stderr` → `main` · +4 −2 · 1 files · 3 commits · open Claimed in the coordination issue as: TEST-WINDOWS-ANSI-STDERR (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why `WorkDirectory.test_file_blocking_work_directory_is_a_cli_error` in `tests/test_run_gpu_tests_paths.py` runs `scripts/run_gpu_tests.py` with `-I` and asserts on its stderr. That stderr quotes a localized OS error ("Impossible de créer un fichier déjà existant" on a French install). `-I` ignores `PYTHONUTF8`, so the child wrote the message in the ANSI code page (cp1252), while a parent running with `PYTHONUTF8=1` decoded the pipe as UTF-8. The reader thread raised `UnicodeDecodeError`, `result.stderr` came back `None`, and both subtests (`blocked_child=''` and `'spirv'`) failed with a `TypeError` before their assertions ran. The child now runs with `-X utf8` (which `-I` keeps) and the parent decodes with `encoding="utf-8"`, so both sides agree whatever the host locale or `PYTHONUTF8` setting. Decoding stays strict, so a real mismatch would still show. Test-only change; `scripts/run_gpu_tests.py` is untouched. ### Tested Windows 11 (French, ANSI code page cp1252), Python 3.14.0, `python -m pytest tests/test_run_gpu_tests_paths.py`: - main, `PYTHONUTF8=1`: 2 subtests fail (`UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9`, then `TypeError: argument of type 'NoneType' is not a container or iterable` at line 145). - main, without `PYTHONUTF8`: passes. - this branch, `PYTHONUTF8=1`: 21 passed, 7 subtests passed. - this branch, without `PYTHONUTF8`: 21 passed, 7 subtests passed. GPUs tested: n/a (the test uses stand-in tool files; no GPU runs) AI-assisted: yes (Claude Code) ### 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) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
test_file_blocking_work_directory_is_a_cli_error runs run_gpu_tests.py with
-I and asserts on its stderr, which quotes a localized OS error ("Impossible
de créer un fichier déjà existant" on a French install). -I ignores
PYTHONUTF8, so the child wrote that text in the ANSI code page (cp1252),
while a parent in UTF-8 mode decoded the pipe as UTF-8. The reader thread
raised UnicodeDecodeError, result.stderr came back None, and the test failed
with a TypeError before its assertions ran.

Run the child with -X utf8 (which -I keeps) and decode with
encoding="utf-8", so both sides agree whatever the host locale or
PYTHONUTF8 setting. No script change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:18:17 +00:00
Author
Owner

@⁠DeadlyChirp on GitHub · 2026-11-26 10:00 UTC · original · edited 2026-11-26 10:30 UTC

Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.

  • tests/test_run_gpu_tests_paths.py: 21 passed, 7 subtests passed.

(AI-assisted test run; output checked by hand.)

**@⁠DeadlyChirp** on GitHub · 2026-11-26 10:00 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2112#issuecomment-7188786295) · edited 2026-11-26 10:30 UTC Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main. - `tests/test_run_gpu_tests_paths.py`: 21 passed, 7 subtests passed. (AI-assisted test run; output checked by hand.)
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2112/head:github-bot/gh-2112'
git switch 'github-bot/gh-2112'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2112'
git switch 'github-bot/gh-2112'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2112'
git switch 'github-bot/gh-2112'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2112'
git switch 'main'
git merge --squash 'github-bot/gh-2112'
git switch 'main'
git merge --ff-only 'github-bot/gh-2112'
git switch 'main'
git merge 'github-bot/gh-2112'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.