diff options
| author | Mohamed Hegazy <mhegazy@anthropic.com> | 2026-10-22 00:10:26 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-10-22 00:10:26 +0000 |
| commit | eb095d1629ab8df42d5362105ab7e7fd94810df1 (patch) | |
| tree | 81b6a86ebf0747548ceffef1f50bba5516a48fa8 /plugins | |
| parent | f3083076bc3ebdea5a1018d407fbd268cc02e734 (diff) | |
security-guidance: session transcript tests use the shared stand-in CLI
The stand-in inner CLI was a /bin/sh script, which cannot be started on Windows. Use the test suite's write_cli helper instead.
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/security-guidance/tests/test_review_session_persistence.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/plugins/security-guidance/tests/test_review_session_persistence.py b/plugins/security-guidance/tests/test_review_session_persistence.py index 6e1c4d3c..83dd4bff 100644 --- a/plugins/security-guidance/tests/test_review_session_persistence.py +++ b/plugins/security-guidance/tests/test_review_session_persistence.py @@ -7,6 +7,7 @@ import pytest from conftest import ( HOOKS_DIR, STUB_VULN, VULN_PY, bash_payload, commit_file, run_hook, + write_cli, ) import llm @@ -24,12 +25,16 @@ def _stub_cli(tmp_path, reject_flag=False): older than the flag does.""" log = tmp_path / "inner-cli-launches" reject = ( - f'case " $* " in *" {FLAG} "*) ' - f'echo "error: unknown option \'{FLAG}\'" >&2; exit 1;; esac\n' + f"if {FLAG!r} in sys.argv:\n" + f" sys.stderr.write(\"error: unknown option '{FLAG}'\\n\")\n" + " sys.exit(1)\n" ) if reject_flag else "" - cli = tmp_path / "claude" - cli.write_text(f'#!/bin/sh\necho "$*" >> "{log}"\n{reject}exit 1\n') - cli.chmod(0o755) + cli = write_cli(tmp_path, "claude", ( + "import sys\n" + f"with open({str(log)!r}, 'a') as f:\n" + " f.write(' '.join(sys.argv[1:]) + '\\n')\n" + f"{reject}" + "sys.exit(1)\n")) return str(cli), log |
