Skip to content

fix(tests): run_all.py prints a failed check's quotes into a Windows pipe instead of stopping - #2666

Merged
hckrman101 merged 2 commits into
NotRexed:mainfrom
nullifyshot:fix/run-all-console-encoding
Nov 12, 2026
Merged

hckrman101 merged 2 commits into
NotRexed:mainfrom
nullifyshot:fix/run-all-console-encoding

Conversation

@nullifyshot

Copy link
Copy Markdown
Contributor

Why: on Windows, tests/run_all.py stops with a UnicodeEncodeError as soon as it prints the output of a failed check that has a curly quote, an arrow or U+FFFD in it, whenever its output goes to a pipe: CI's log, an agent's tool, | more. Compiler errors have such quotes, and the runner's own decode("utf-8", "replace") makes U+FFFD. The run then never prints its result table or its summary line, and --write-times doesn't write. It shows in CI too: UnicodeEncodeError: 'charmap' codec can't encode character '�' in the Windows source-check jobs. dyst found it while fixing the same crash in team_chat.py (#2640).

What changed

  • tests/run_all.py: unicode_output() at the start of main(), the same as fix(agents): team_chat.py read no longer stops at the first post on Windows #2640's for team_chat.py. A pipe gets UTF-8 (as -X utf8 would give it). A console keeps its own encoding. Either way, a character the stream can't show is replaced instead of ending the run.
  • tests/test_run_all_output.py (new): runs a copy of run_all.py in a scratch git repository with one check that fails printing ‘x’ … � → …. Its stdout is a pipe with PYTHONIOENCODING=cp1252, as Windows gives one, so the test works on any OS. It checks that there's no UnicodeEncodeError, that the failed output is printed whole as UTF-8, that the summary line follows, and that the exit code is 1.

Tested (Windows 11)

Not tested: Linux, where pipes are already UTF-8 under the usual locales; the test forces cp1252 there too, but I haven't run it on Linux.

🤖 Generated with Claude Code

nullifyshot and others added 2 commits November 12, 2026 00:39
…pipe instead of stopping

Into a pipe, Windows' Python writes cp1252, which has no curly quotes,
arrows or U+FFFD. The first failed check whose output had one (compiler
errors do; the runner's own "replace" decode makes U+FFFD) ended the run
with a UnicodeEncodeError, before the table, the summary line and
--write-times. A pipe now gets UTF-8 and a console keeps its encoding,
replacing what it cannot show, as scripts/team_chat.py does since NotRexed#2640.

tests/test_run_all_output.py runs a copy of run_all.py in a scratch
repository with one failing check that prints those characters, its
stdout a cp1252 pipe on any OS; it fails without the change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… as on CI's Python

On Windows CI's Python the stand-in check's own print() met the cp1252
pipe too and stopped with its own UnicodeEncodeError, which the runner
then printed: the test caught that text, not a runner crash. The check
now writes UTF-8 bytes itself, as a compiler does, and the test looks
for the runner's traceback in stderr only. It still fails without the
run_all.py change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nullifyshot
nullifyshot force-pushed the fix/run-all-console-encoding branch from a7bc83c to 8c227d0 Compare November 12, 2026 05:40
@hckrman101
hckrman101 merged commit 8a10b34 into NotRexed:main Nov 12, 2026
13 checks passed
@nullifyshot
nullifyshot deleted the fix/run-all-console-encoding branch November 12, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant