Skip to content

Commit 5b9c078

Browse files
author
Arturo R Montesinos
committed
test: cover --list-sheets error cases
1 parent fbc70ad commit 5b9c078

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/test_cli.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,20 @@ def test_list_sheets_prints_sheet_names_and_exits_zero() -> None:
4646
# should be at least one non-empty line of output.
4747
lines = [line.strip() for line in result.stdout.splitlines() if line.strip()]
4848
assert lines
49+
50+
51+
def test_list_sheets_without_file_is_usage_error() -> None:
52+
result = run_cli("--list-sheets")
53+
assert result.returncode == 2
54+
assert "--list-sheets requires a FILE argument" in result.stderr
55+
56+
57+
def test_list_sheets_with_missing_file_is_runtime_error() -> None:
58+
project_root = Path(__file__).resolve().parents[1]
59+
missing = project_root / "tests" / "fixtures" / "does-not-exist.ods"
60+
assert not missing.exists()
61+
62+
result = run_cli("--list-sheets", str(missing))
63+
assert result.returncode == 1
64+
# Error message should mention the missing file path.
65+
assert str(missing) in result.stderr

0 commit comments

Comments
 (0)