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
3 changes: 3 additions & 0 deletions src/steerbench/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ def main(argv: list[str] | None = None) -> int:
parser = _build_parser()
args, extra = parser.parse_known_args(argv)

if not args.stem.strip():
parser.error("output stem must not be empty")

if args.run:
return _run_modal(args.run, extra)

Expand Down
23 changes: 23 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,26 @@ def test_cli_errors_on_missing_named_side_csv(
)
assert exc.value.code != 0
assert "side-effects CSV not found" in capsys.readouterr().err


@pytest.mark.parametrize("stem", ["", " "])
def test_cli_errors_on_empty_stem(
stem: str, tmp_path: Path, capsys: pytest.CaptureFixture[str]
) -> None:
# An empty or whitespace-only --stem would write cryptic dotfiles
# (".md", ".html", ".png"); it must fail fast instead.
with pytest.raises(SystemExit) as exc:
cli.main(
[
"--dose-csv",
str(_DOSE),
"--layer-csv",
str(_LAYER),
"--out",
str(tmp_path / "o"),
"--stem",
stem,
]
)
assert exc.value.code != 0
assert "output stem must not be empty" in capsys.readouterr().err