Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tests/scripts/test_contributor_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ def test_cli_entrypoint_end_to_end(tmp_path):
scripts = tmp_path / "scripts"
scripts.mkdir()
for name in ("add_contributor.py",):
(scripts / name).write_text((SCRIPTS_DIR / name).read_text())
# Explicit encoding: add_contributor.py contains UTF-8 multi-byte
# characters (an em dash), so the locale-default read_text() raises
# UnicodeDecodeError on non-UTF-8 Windows locales (e.g. cp950).
(scripts / name).write_text(
(SCRIPTS_DIR / name).read_text(encoding="utf-8"), encoding="utf-8"
)
# Minimal stub release.py so the legacy lookup import works
(scripts / "release.py").write_text("LEGACY_AUTHOR_MAP = {}\n")
proc = subprocess.run(
Expand All @@ -109,5 +114,5 @@ def test_cli_entrypoint_end_to_end(tmp_path):
cwd=tmp_path, capture_output=True, text=True,
)
assert proc.returncode == 0, proc.stderr
out = (tmp_path / "contributors" / "emails" / "cli@example.com").read_text()
out = (tmp_path / "contributors" / "emails" / "cli@example.com").read_text(encoding="utf-8")
assert out.splitlines()[0] == "cliperson"