[Test] Unify L2/L3 test layout, Buildkite steps, and test helpers (#2556)
Signed-off-by: wangyu <410167048@qq.com> Signed-off-by: Huang, Zeyu <11222265+fhfuih@users.noreply.github.com> Signed-off-by: wangyu <53896905+yenuo26@users.noreply.github.com> Co-authored-by: Huang, Zeyu <11222265+fhfuih@users.noreply.github.com>
This commit is contained in:
1 parent
b85833eeec
commit
6f2ad7b403
134 files changed
+4904
-4185
No files matched your search
@@ -3,7 +3,8 @@
|
||||
Loading ``tests.helpers.runtime`` at plugin import time (before session fixtures)
|
||||
pulls in vLLM/vllm_omni too early and breaks initialization order vs the legacy
|
||||
monolithic conftest. Defer imports until fixtures run so ``default_env`` /
|
||||
``default_vllm_config`` run first.
|
||||
``default_vllm_config`` run first. Implementation helpers live in
|
||||
``tests.helpers.runtime`` (``iter_omni_server`` / ``iter_omni_runner``).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -15,7 +16,7 @@ from typing import TYPE_CHECKING, Any
|
||||
import pytest
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from tests.helpers.runtime import OmniServer
|
||||
from tests.helpers.runtime import OmniRunner, OmniServer
|
||||
|
||||
omni_fixture_lock = threading.Lock()
|
||||
|
||||
@@ -26,9 +27,9 @@ def omni_server_function(
|
||||
run_level: str,
|
||||
model_prefix: str,
|
||||
) -> Generator[OmniServer, Any, None]:
|
||||
from tests.helpers.runtime import run_omni_server
|
||||
from tests.helpers.runtime import iter_omni_server
|
||||
|
||||
yield from run_omni_server(request, run_level, model_prefix, omni_fixture_lock)
|
||||
yield from iter_omni_server(request, run_level, model_prefix, omni_fixture_lock)
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
@@ -39,9 +40,9 @@ def omni_server(request: pytest.FixtureRequest, run_level: str, model_prefix: st
|
||||
The ``use_stage_cli`` flag on ``OmniServerParams`` routes the setup through the
|
||||
stage-CLI harness while still reusing the same fixture grouping semantics.
|
||||
"""
|
||||
from tests.helpers.runtime import run_omni_server
|
||||
from tests.helpers.runtime import iter_omni_server
|
||||
|
||||
yield from run_omni_server(request, run_level, model_prefix, omni_fixture_lock)
|
||||
yield from iter_omni_server(request, run_level, model_prefix, omni_fixture_lock)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -62,23 +63,43 @@ def openai_client_function(request: pytest.FixtureRequest, run_level: str):
|
||||
return OpenAIClientHandler(host=server.host, port=server.port, api_key="EMPTY", run_level=run_level)
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def omni_runner_function(
|
||||
request: pytest.FixtureRequest,
|
||||
model_prefix: str,
|
||||
run_level: str,
|
||||
) -> Generator[OmniRunner, Any, None]:
|
||||
"""Function-scoped :class:`~tests.helpers.runtime.OmniRunner` (cf. :func:`omni_server_function`).
|
||||
|
||||
Tears down the runner after each test so the next test does not share engine
|
||||
state with a module-scoped :func:`omni_runner`.
|
||||
"""
|
||||
from tests.helpers.runtime import iter_omni_runner
|
||||
|
||||
yield from iter_omni_runner(request, model_prefix, run_level, omni_fixture_lock)
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def omni_runner(request: pytest.FixtureRequest, model_prefix: str):
|
||||
from tests.helpers.runtime import OmniRunner
|
||||
def omni_runner(request: pytest.FixtureRequest, model_prefix: str, run_level: str) -> Generator[OmniRunner, Any, None]:
|
||||
"""Module-scoped :class:`~tests.helpers.runtime.OmniRunner` (cf. :func:`omni_server`).
|
||||
|
||||
with omni_fixture_lock:
|
||||
model, stage_config_path = request.param
|
||||
model = model_prefix + model
|
||||
with OmniRunner(model, seed=42, stage_configs_path=stage_config_path) as runner:
|
||||
print("OmniRunner started successfully")
|
||||
yield runner
|
||||
print("OmniRunner stopping...")
|
||||
Reuses one runner for the whole module to amortize multi-stage init cost.
|
||||
"""
|
||||
from tests.helpers.runtime import iter_omni_runner
|
||||
|
||||
print("OmniRunner stopped")
|
||||
yield from iter_omni_runner(request, model_prefix, run_level, omni_fixture_lock)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def omni_runner_handler(omni_runner: Any):
|
||||
def omni_runner_handler_function(omni_runner_function: OmniRunner):
|
||||
"""Resolve :class:`~tests.helpers.runtime.OmniRunnerHandler` for :func:`omni_runner_function`."""
|
||||
from tests.helpers.runtime import OmniRunnerHandler
|
||||
|
||||
return OmniRunnerHandler(omni_runner_function)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def omni_runner_handler(omni_runner: OmniRunner):
|
||||
from tests.helpers.runtime import OmniRunnerHandler
|
||||
|
||||
return OmniRunnerHandler(omni_runner)
|
||||
Reference in new issue
Block a user