diff options
| author | Mohamed Hegazy <mhegazy@anthropic.com> | 2026-10-22 00:44:39 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-10-22 00:44:39 +0000 |
| commit | 89a2c8b4356767441800d8b6799bd3ee11e63a51 (patch) | |
| tree | 50292b5cc9f7992bc30052fddb9b37c793797331 /plugins | |
| parent | eb095d1629ab8df42d5362105ab7e7fd94810df1 (diff) | |
security-guidance: stand-in CLI in the session transcript tests logs as UTF-8
The commit reviewer's system prompt has a character the Windows default encoding cannot write, so on Windows the stand-in failed before logging the review launch and three tests saw no launch.
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/security-guidance/tests/test_review_session_persistence.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/security-guidance/tests/test_review_session_persistence.py b/plugins/security-guidance/tests/test_review_session_persistence.py index 83dd4bff..0643bea1 100644 --- a/plugins/security-guidance/tests/test_review_session_persistence.py +++ b/plugins/security-guidance/tests/test_review_session_persistence.py @@ -31,7 +31,8 @@ def _stub_cli(tmp_path, reject_flag=False): ) if reject_flag else "" cli = write_cli(tmp_path, "claude", ( "import sys\n" - f"with open({str(log)!r}, 'a') as f:\n" + # utf-8: the reviewer's prompt has characters cp1252 cannot write. + f"with open({str(log)!r}, 'a', encoding='utf-8') as f:\n" " f.write(' '.join(sys.argv[1:]) + '\\n')\n" f"{reject}" "sys.exit(1)\n")) @@ -40,7 +41,8 @@ def _stub_cli(tmp_path, reject_flag=False): def _reviews(log): """Argument lines of the review launches (the SDK also probes `-v`).""" - return [l for l in log.read_text().splitlines() if "--input-format" in l] + return [l for l in log.read_text(encoding="utf-8").splitlines() + if "--input-format" in l] @pytest.fixture |
