diff --git a/src/python_learning_orchestrated/cli.py b/src/python_learning_orchestrated/cli.py index 31751d2..676d896 100644 --- a/src/python_learning_orchestrated/cli.py +++ b/src/python_learning_orchestrated/cli.py @@ -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 ' to create one." + ) return output_fn(f"Checkpoints ({len(checkpoints)}):") for checkpoint in checkpoints: diff --git a/tests/test_cli_smoke.py b/tests/test_cli_smoke.py index e54e34c..9622b51 100644 --- a/tests/test_cli_smoke.py +++ b/tests/test_cli_smoke.py @@ -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 ' to create one." + 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"