fix(upstream_triage): force UTF-8 stdout and decode git output as UTF-8 (#544) (#547)

* fix(upstream_triage): force UTF-8 stdout and decode git output as UTF-8 (#544)

* test(tools-utf8): restore assertion in salary converter test and isolate upstream_triage test
This commit is contained in:
Oscar Madera authored and GitHub committed 2026-10-17 19:44:56 +02:00
1 parent 407dc34a2c
commit 011a8b8435
3 files changed
+48 -3

No files matched your search

+22
View File
@@ -149,6 +149,28 @@ class ToolsWriteUtf8(unittest.TestCase):
])
self.assert_clean_utf8(proc, 0, CYRILLIC)
def test_upstream_triage_handles_non_latin_commit_subjects(self):
repo = self.tmp / "repo"
repo.mkdir()
tools_dir = repo / "tools"
tools_dir.mkdir()
shutil.copy(TOOLS / "upstream_triage.py", tools_dir / "upstream_triage.py")
subprocess.run(["git", "init", "-b", "master"], cwd=repo, check=True, capture_output=True)
subprocess.run(["git", "config", "user.name", "Test"], cwd=repo, check=True, capture_output=True)
subprocess.run(["git", "config", "user.email", "test@example.com"], cwd=repo, check=True, capture_output=True)
subprocess.run(["git", "remote", "add", "upstream", "https://github.com/MadsLorentzen/ai-job-search.git"], cwd=repo, check=True, capture_output=True)
(repo / "file.txt").write_text("hello\n", encoding="utf-8")
subprocess.run(["git", "add", "file.txt"], cwd=repo, check=True, capture_output=True)
subprocess.run(["git", "commit", "-m", "init"], cwd=repo, check=True, capture_output=True)
(repo / "file.txt").write_text("change\n", encoding="utf-8")
subprocess.run(["git", "add", "file.txt"], cwd=repo, check=True, capture_output=True)
msg = f"feat: add support for {CYRILLIC}"
subprocess.run(["git", "commit", "-m", msg], cwd=repo, check=True, capture_output=True)
subprocess.run(["git", "update-ref", "refs/remotes/upstream/master", "HEAD"], cwd=repo, check=True, capture_output=True)
subprocess.run(["git", "reset", "--hard", "HEAD~1"], cwd=repo, check=True, capture_output=True)
proc = run_legacy_stdout([repo / "tools" / "upstream_triage.py"], cwd=repo)
self.assert_clean_utf8(proc, 0, CYRILLIC)
if __name__ == "__main__":
unittest.main()