From 08907cf504c0fdc5ccb789bad5216f15703653a6 Mon Sep 17 00:00:00 2001 From: arvarik <9952627+arvarik@users.noreply.github.com> Date: Thu, 7 May 2026 21:07:25 +0000 Subject: [PATCH] test(cli): add coverage for run CLI arguments Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- tests/test_run_cmd.py | 62 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tests/test_run_cmd.py b/tests/test_run_cmd.py index b3d307e..f974c11 100644 --- a/tests/test_run_cmd.py +++ b/tests/test_run_cmd.py @@ -3,6 +3,7 @@ from __future__ import annotations from pathlib import Path +from unittest.mock import MagicMock, patch import pytest from typer.testing import CliRunner @@ -81,3 +82,64 @@ def test_panel_shows_step_info(self, project: Path) -> None: ) assert "step1-spec" in result.output assert "My feature" in result.output + + def test_cli_args_passed_to_executor(self, project: Path) -> None: + """Verify CLI arguments are correctly passed to StepExecutor.""" + with patch("gemstack.cli.run_cmd.StepExecutor") as mock_executor_class: + mock_executor = mock_executor_class.return_value + # Mock the execute method to return a successful result + mock_result = MagicMock() + mock_result.success = True + mock_result.summary.return_value = "Mock success" + mock_executor.execute.return_value = mock_result + + result = runner.invoke( + app, + [ + "run", + "step1-spec", + "Test feature", + "--project", + str(project), + "--model", + "custom-model", + "--max-cost", + "50.0", + "--max-tokens", + "10000", + ], + ) + + assert result.exit_code == 0 + mock_executor_class.assert_called_once_with( + model="custom-model", + max_cost=50.0, + max_tokens=10000, + ) + + def test_default_cli_args_passed_to_executor(self, project: Path) -> None: + """Verify default CLI arguments are correctly passed to StepExecutor.""" + with patch("gemstack.cli.run_cmd.StepExecutor") as mock_executor_class: + mock_executor = mock_executor_class.return_value + mock_result = MagicMock() + mock_result.success = True + mock_result.summary.return_value = "Mock success" + mock_executor.execute.return_value = mock_result + + result = runner.invoke( + app, + [ + "run", + "step1-spec", + "Test feature", + "--project", + str(project), + ], + ) + + assert result.exit_code == 0 + mock_executor_class.assert_called_once_with( + model="gemini-3.1-pro-preview", + max_cost=None, + max_tokens=None, + )