Skip to content

Commit 637a611

Browse files
test(cli): add missing test for cloud_run python_version flag
1 parent 3a0afd4 commit 637a611

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/unittests/cli/utils/test_cli_tools_click.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,35 @@ def test_cli_deploy_cloud_run_allows_empty_gcloud_args(
386386
assert extra_args == ()
387387

388388

389+
def test_cli_deploy_cloud_run_python_version(
390+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
391+
) -> None:
392+
"""--python_version should be forwarded to cli_deploy.to_cloud_run."""
393+
rec = _Recorder()
394+
monkeypatch.setattr(cli_tools_click.cli_deploy, "to_cloud_run", rec)
395+
396+
agent_dir = tmp_path / "agent_cr_pyver"
397+
agent_dir.mkdir()
398+
runner = CliRunner()
399+
result = runner.invoke(
400+
cli_tools_click.main,
401+
[
402+
"deploy",
403+
"cloud_run",
404+
"--project",
405+
"proj",
406+
"--region",
407+
"us-central1",
408+
"--python_version",
409+
"3.12",
410+
str(agent_dir),
411+
],
412+
)
413+
assert result.exit_code == 0
414+
assert rec.calls, "cli_deploy.to_cloud_run must be invoked"
415+
assert rec.calls[0][1].get("python_version") == "3.12"
416+
417+
389418
# cli deploy agent_engine
390419
def test_cli_deploy_agent_engine_success(
391420
tmp_path: Path, monkeypatch: pytest.MonkeyPatch

0 commit comments

Comments
 (0)