tests: decode the GPU work-directory error as UTF-8 on non-English Windows (TEST-WINDOWS-ANSI-STDERR) #2112
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2112
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/run-gpu-tests-ansi-stderr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Claimed in the coordination issue as: TEST-WINDOWS-ANSI-STDERR (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7174699096)
What and why
WorkDirectory.test_file_blocking_work_directory_is_a_cli_errorintests/test_run_gpu_tests_paths.pyrunsscripts/run_gpu_tests.pywith-Iand asserts on its stderr. That stderr quotes a localized OS error("Impossible de créer un fichier déjà existant" on a French install).
-IignoresPYTHONUTF8, so the childwrote the message in the ANSI code page (cp1252), while a parent running with
PYTHONUTF8=1decoded the pipeas UTF-8. The reader thread raised
UnicodeDecodeError,result.stderrcame backNone, and both subtests(
blocked_child=''and'spirv') failed with aTypeErrorbefore their assertions ran.The child now runs with
-X utf8(which-Ikeeps) and the parent decodes withencoding="utf-8", so both sidesagree whatever the host locale or
PYTHONUTF8setting. Decoding stays strict, so a real mismatch would still show.Test-only change;
scripts/run_gpu_tests.pyis untouched.Tested
Windows 11 (French, ANSI code page cp1252), Python 3.14.0,
python -m pytest tests/test_run_gpu_tests_paths.py:PYTHONUTF8=1: 2 subtests fail (UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9, thenTypeError: argument of type 'NoneType' is not a container or iterableat line 145).PYTHONUTF8: passes.PYTHONUTF8=1: 21 passed, 7 subtests passed.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
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a)🤖 Generated with Claude Code
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.)
#2112 | head
92465a0847292753c72b10f7e8578236f2ff44cb|python3 -I tests/test_run_gpu_tests_paths.py -v,py -3.12 -I -X utf8 tests/test_run_gpu_tests_paths.py -v| red: Linux 21 passed / Windows 21 passed | green: Linux 21 passed / Windows 21 passed | Green on both treesI also ran the untouched main file and both prescribed phases on native Windows 11 (English, ANSI cp1252) with a UTF-8 parent. All three passed. This host did not reproduce the localized Windows stderr failure described in the PR.
Pinned main
33db04a7010e81c40a7a6a15624525aa0c4a3a58, merged into this PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4 and Windows 11 Pro, Python 3.12.10. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.Merged, thank you @MoonEyes!
What it does: fixes
tests/test_run_gpu_tests_paths.pyon a non-English Windows. The test runsscripts/run_gpu_tests.pywith-Iand checks its stderr, which quotes a localized OS error ("Impossible de créer un fichier déjà existant" on a French install).-IignoresPYTHONUTF8, so the child wrote that message in the ANSI code page while a UTF-8 parent tried to decode it as UTF-8: the read failed, stderr came backNone, and the test died with aTypeError. The child now runs with-X utf8(which-Ikeeps) and the parent decodes as UTF-8. Test-only,run_gpu_tests.pyis untouched.How it was checked: sodove ran the test on Linux and on an English Windows 11 at head
92465a084: it passes on main and with the PR there, because an English OS message has no accent to break the decoding. So we rebuilt the bug by hand: a child run with-Iwriting the French message, read the way the test reads it. With main's setup the parent getsUnicodeDecodeErroron byte0xe9(the "é") andNonefor stderr, exactly as described here; with this PR's-I -X utf8andencoding="utf-8"the French message decodes correctly. We also confirmed that under-Ithe child is not in UTF-8 mode (stderr in cp1252) and that-X utf8survives-I.CI: its red jobs match main's known failures.
Merged as part of the same reviewed batch.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.