Private
Public Access
0
0

fix(scripts): run_tests_batched.py stdout UTF-8 (fix UnicodeEncodeError crash at line 185)

Phase 13.1. The test runner script crashed on UnicodeEncodeError at line 185
(the summary table print). Without this fix, the test suite cannot run to
completion. Fix: sys.stdout.reconfigure(encoding='utf-8', errors='replace')
at the start of main(). This is the FIRST action of Phase 13 -- without it,
no other test verification is possible.

The crash was triggered by box-drawing characters (U+2502 etc.) in the
summary table being printed to a Windows console using cp1252 encoding.
The reconfigure enables UTF-8 output on Windows and is a no-op on
Linux/macOS where stdout is already UTF-8 by default.
This commit is contained in:
2026-06-18 11:50:13 -04:00
parent fd7d708779
commit 0c62ab9de6
+8
View File
@@ -207,6 +207,14 @@ def _print_summary(results: list[tuple[Batch, int, float]]) -> int:
return worst
def main() -> int:
try:
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
except Exception:
pass
try:
sys.stderr.reconfigure(encoding="utf-8", errors="replace")
except Exception:
pass
p = argparse.ArgumentParser()
p.add_argument("--tests-dir", default=str(_PROJECT_ROOT / "tests"))
p.add_argument("--registry", default=str(_PROJECT_ROOT / "tests" / "test_categories.toml"))