Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions src/steerbench/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ def main(argv: list[str] | None = None) -> int:
if not csv_path.exists():
parser.error(f"{label} CSV not found: {csv_path}")

# An explicitly named side CSV must exist; only an *unspecified* one may
# fall back to the header-only stub.
if args.side_csv is not None and not args.side_csv.exists():
parser.error(f"side-effects CSV not found: {args.side_csv}")

side_csv = _ensure_side_csv(args.side_csv, args.out)
outputs = report.build_report(
dose_csv=args.dose_csv,
Expand Down
22 changes: 22 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,25 @@ def test_cli_json_emits_artifact_paths(tmp_path: Path, capsys: pytest.CaptureFix
def test_cli_errors_on_missing_csv(tmp_path: Path) -> None:
with pytest.raises(SystemExit):
cli.main(["--dose-csv", str(tmp_path / "nope.csv"), "--out", str(tmp_path / "o")])


def test_cli_errors_on_missing_named_side_csv(
tmp_path: Path, capsys: pytest.CaptureFixture[str]
) -> None:
# An explicitly named --side-csv that doesn't exist must error, not
# silently fall back to the header-only stub (that's for unspecified only).
with pytest.raises(SystemExit) as exc:
cli.main(
[
"--dose-csv",
str(_DOSE),
"--layer-csv",
str(_LAYER),
"--side-csv",
str(tmp_path / "typo.csv"),
"--out",
str(tmp_path / "o"),
]
)
assert exc.value.code != 0
assert "side-effects CSV not found" in capsys.readouterr().err