Skip to content
Open
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: 4 additions & 1 deletion src/python_learning_orchestrated/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ def main(
if args.checkpoint_command == "list":
checkpoints = checkpoint_store.list_checkpoints()
if not checkpoints:
output_fn("No checkpoints found.")
output_fn(
"No checkpoints found. "
"Run 'checkpoint create <name>' to create one."
)
return
output_fn(f"Checkpoints ({len(checkpoints)}):")
for checkpoint in checkpoints:
Expand Down
18 changes: 18 additions & 0 deletions tests/test_cli_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,24 @@ def test_cli_export_and_import_progress_commands(tmp_path, capsys) -> None:
assert len(session_payload["attempts"]) == 1


def test_cli_checkpoint_list_empty(tmp_path, capsys, monkeypatch) -> None:
checkpoint_dir = tmp_path / "checkpoints"

checkpoint_store_class = cli_module.CheckpointStore
monkeypatch.setattr(
cli_module,
"CheckpointStore",
lambda: checkpoint_store_class(checkpoint_dir),
)

main(["checkpoint", "list"])
list_output = capsys.readouterr().out
assert (
"No checkpoints found. Run 'checkpoint create <name>' to create one."
in list_output
)
Comment on lines +106 to +109

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve readability, it's a good practice to store long expected strings in a variable. This makes the assertion line shorter, clearer, and easier to maintain.

    expected_output = "No checkpoints found. Run 'checkpoint create <name>' to create one."
    assert expected_output in list_output



def test_cli_checkpoint_create_and_list(tmp_path, capsys, monkeypatch) -> None:
session_file = tmp_path / "session.json"
checkpoint_dir = tmp_path / "checkpoints"
Expand Down
Loading