Skip to content

fix(test): read add_contributor.py with explicit UTF-8 encoding - #79490

Closed
a0000001 wants to merge 1 commit into
NousResearch:mainfrom
a0000001:fix/contributor-map-test-cp950-encoding
Closed

fix(test): read add_contributor.py with explicit UTF-8 encoding#79490
a0000001 wants to merge 1 commit into
NousResearch:mainfrom
a0000001:fix/contributor-map-test-cp950-encoding

Conversation

@a0000001

@a0000001 a0000001 commented Aug 5, 2026

Copy link
Copy Markdown

What

test_cli_entrypoint_end_to_end copies add_contributor.py with read_text() / write_text() and no encoding argument, so both fall back to the system locale.

Why

add_contributor.py contains UTF-8 multi-byte characters (an em dash), so the read raises UnicodeDecodeError on any non-UTF-8 Windows locale — reproduced on cp950 (Traditional Chinese Windows), where this test fails on every run. The trailing mapping-file read gets the same treatment for symmetry.

Same footgun class as the subprocess text=True sweep in #60741, just on the pathlib read_text/write_text side.

Verification

pytest tests/scripts/test_contributor_map.py — 7/7 pass on a cp950-locale Windows host (previously 1 failed).

🤖 Generated with Claude Code

test_cli_entrypoint_end_to_end copies add_contributor.py with
read_text()/write_text() and no encoding argument, so both fall back to
the system locale. add_contributor.py contains UTF-8 multi-byte
characters (an em dash), which makes the read raise UnicodeDecodeError
on any non-UTF-8 Windows locale (observed on cp950 / Traditional
Chinese). The trailing mapping-file read gets the same treatment for
symmetry.

Same footgun class as the subprocess text=True sweep in NousResearch#60741, just on
the pathlib read_text/write_text side.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@alt-glitch alt-glitch added type/test Test coverage or test infrastructure P3 Low — cosmetic, nice to have platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows labels Aug 5, 2026
@teknium1

teknium1 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Merged in #81965 — clean cherry-pick with authorship. Thanks!

@teknium1 teknium1 closed this Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants