Skip to content

Commit 2222564

Browse files
committed
Make system-prompt-file rejection test robust to CI color rendering
CI runs pytest with FORCE_COLOR, so the Rich usage-error panel carries ANSI codes and width-based ellipsis — the long "Invalid value for '--system-prompt-file'" substring no longer matched on the Windows/Linux runners. Assert the behavioral distinction instead: a nonexistent --system-prompt-file makes Typer reject before the body, so the sandbox guard (the other exit-2 path) never runs and "sandbox" stays out of the output. This still kills the exists=True mutant and is immune to ANSI/width.
1 parent 6e07c58 commit 2222564

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎tests/test_agent_framework_command.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,13 @@ def test_unknown_voice_is_a_usage_error():
7676

7777

7878
def test_missing_system_prompt_file_is_rejected_by_typer():
79-
# exists=True on the option makes Typer reject a nonexistent path before the body
80-
# (distinct from the sandbox guard a passing path would hit).
79+
# exists=True on the option makes Typer reject a nonexistent path before the body,
80+
# so the sandbox guard (the other exit-2 path) never runs. Asserting the guard's
81+
# message is absent kills the exists=True mutant without depending on the Rich error
82+
# text, which CI renders with ANSI + width ellipsis.
8183
result = runner.invoke(app, ["agent-framework", "--system-prompt-file", "/no/such/file"])
8284
assert result.exit_code == 2
83-
assert "Invalid value for '--system-prompt-file'" in " ".join(result.output.split())
85+
assert "sandbox" not in result.output.lower()
8486

8587

8688
def test_production_env_is_rejected_with_sandbox_hint():

0 commit comments

Comments
 (0)