From 06f67695f1819f795956b8d51f5c982aa082937d Mon Sep 17 00:00:00 2001 From: shiyichuan <93317314+CarrotSwordsman@users.noreply.github.com> Date: Wed, 9 Sep 2026 22:05:44 +0800 Subject: [PATCH] [CI/Build] Avoid duplicate stage CLI deploy config (#7007) Signed-off-by: mershi Co-authored-by: mershi --- tests/helpers/runtime.py | 1 - tests/helpers/tests/test_runtime_stage_cli.py | 38 ++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/tests/helpers/runtime.py b/tests/helpers/runtime.py index db4cba893..66e0cefab 100644 --- a/tests/helpers/runtime.py +++ b/tests/helpers/runtime.py @@ -968,7 +968,6 @@ def iter_omni_server( raise ValueError("omni_server with use_stage_cli=True requires use_omni=True") if stage_config_path is None: raise ValueError("omni_server with use_stage_cli=True requires a stage_config_path") - server_args += ["--deploy-config", stage_config_path] with OmniServerStageCli( model, diff --git a/tests/helpers/tests/test_runtime_stage_cli.py b/tests/helpers/tests/test_runtime_stage_cli.py index 564f12cf1..712a87e09 100644 --- a/tests/helpers/tests/test_runtime_stage_cli.py +++ b/tests/helpers/tests/test_runtime_stage_cli.py @@ -5,12 +5,15 @@ from __future__ import annotations +import threading +from contextlib import nullcontext from pathlib import Path from types import SimpleNamespace import pytest -from tests.helpers.runtime import OmniServerStageCli +from tests.helpers import runtime +from tests.helpers.runtime import OmniServerParams, OmniServerStageCli pytestmark = [pytest.mark.core_model, pytest.mark.cpu] @@ -49,6 +52,39 @@ def test_stage_cli_loads_stage_ids_and_replica_counts(tmp_path: Path) -> None: assert server.stage_replica_counts == {0: 1, 1: 3} +def test_stage_cli_fixture_leaves_deploy_config_to_server(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: + stage_config_path = _write_stage_config(tmp_path) + captured_args: list[str] = [] + + def fake_stage_cli(model, config_path, serve_args, **kwargs): + del kwargs + assert config_path == stage_config_path + captured_args.extend(serve_args) + return nullcontext(SimpleNamespace(model=model)) + + monkeypatch.setattr(runtime, "OmniServerStageCli", fake_stage_cli) + monkeypatch.setattr(runtime, "_whisper_device_free_around", nullcontext) + monkeypatch.setattr( + "tests.helpers.stage_config.stage_config_path_for_run_level", + lambda config_path, _run_level: config_path, + ) + request = SimpleNamespace( + param=OmniServerParams( + model="fake-model", + stage_config_path=stage_config_path, + use_stage_cli=True, + ), + node=SimpleNamespace(get_closest_marker=lambda _name: None), + ) + + server_fixture = runtime.iter_omni_server(request, "core_model", threading.Lock()) + next(server_fixture) + with pytest.raises(StopIteration): + next(server_fixture) + + assert "--deploy-config" not in captured_args + + def test_stage_cli_enter_rolls_back_launched_stages_on_startup_failure( tmp_path: Path, monkeypatch: pytest.MonkeyPatch ) -> None: