rdna2_tools_check: test_cli_scanner fails when PYTHONIOENCODING=utf-8 on a non-UTF-8 code page #838

Closed
opened 2026-11-23 11:56:22 +00:00 by lukaslw-lab · 0 comments
lukaslw-lab commented 2026-11-23 11:56:22 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-23T11:56:22Z.


AI-assisted (Claude Code).

Commit or build

42154de (branch on main c3db335; tests/rdna2_tools_check.py and tools/scan_unsupported_shaders.py are unchanged from main)

Reproduction

$env:PYTHONIOENCODING = 'utf-8'
ctest --preset dev --no-tests=error -R '^rdna2_tools_check$' --output-on-failure

Expected behavior

Pass, as it does with the variable unset.

Observed behavior

test_cli_scanner errors. The reader thread raises UnicodeDecodeError: 'charmap' codec can't decode byte 0x88 in position 244, res.stdout is None, and assertIn at line 2464 raises TypeError.

Cause: with PYTHONIOENCODING=utf-8 the scanner's stdout is UTF-8, so make_progress_bar (encoding check from #241) prints █ (E2 96 88). The test runs it with text=True and no encoding, so the parent decodes in the locale encoding (cp1250 here). Both scanner calls in test_cli_scanner are affected.

Suggested fix: pass encoding="utf-8" and env={**os.environ, "PYTHONIOENCODING": "utf-8"} to both calls, so the two sides agree whatever the caller's environment. #635 fixed the same class of issue for dependency_paths.py.

Environment

Windows 10 22H2 (19045), ANSI code page 1250, Python 3.13.7.

Checklist

  • I reproduced this on a source-built input.
  • I did not include game files, dumps, distribution links or credentials.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6558730961 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/844). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-23T11:56:22Z. --- _AI-assisted (Claude Code)._ ### Commit or build `42154de` (branch on `main` `c3db335`; `tests/rdna2_tools_check.py` and `tools/scan_unsupported_shaders.py` are unchanged from `main`) ### Reproduction ```powershell $env:PYTHONIOENCODING = 'utf-8' ctest --preset dev --no-tests=error -R '^rdna2_tools_check$' --output-on-failure ``` ### Expected behavior Pass, as it does with the variable unset. ### Observed behavior `test_cli_scanner` errors. The reader thread raises `UnicodeDecodeError: 'charmap' codec can't decode byte 0x88 in position 244`, `res.stdout` is `None`, and `assertIn` at line 2464 raises `TypeError`. Cause: with `PYTHONIOENCODING=utf-8` the scanner's stdout is UTF-8, so `make_progress_bar` (encoding check from #241) prints `█` (`E2 96 88`). The test runs it with `text=True` and no `encoding`, so the parent decodes in the locale encoding (cp1250 here). Both scanner calls in `test_cli_scanner` are affected. Suggested fix: pass `encoding="utf-8"` and `env={**os.environ, "PYTHONIOENCODING": "utf-8"}` to both calls, so the two sides agree whatever the caller's environment. #635 fixed the same class of issue for `dependency_paths.py`. ### Environment Windows 10 22H2 (19045), ANSI code page 1250, Python 3.13.7. ### Checklist - [x] I reproduced this on a source-built input. - [x] I did not include game files, dumps, distribution links or credentials.
Sign in to join this conversation.
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
R0Y00/Xbox2Windows#838
No description provided.