From 0c62ab9de67cea7d97a5fb34ad86a5c644669df9 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Thu, 18 Jun 2026 11:50:13 -0400 Subject: [PATCH] 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. --- scripts/run_tests_batched.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/run_tests_batched.py b/scripts/run_tests_batched.py index 70369f76..d173178e 100644 --- a/scripts/run_tests_batched.py +++ b/scripts/run_tests_batched.py @@ -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"))