From 61c7a1b856e32ef8b12c70abcb9fd9ad22619a13 Mon Sep 17 00:00:00 2001 From: Murali Andoorveedu <37849411+andoorve@users.noreply.github.com> Date: Wed, 19 Mar 2025 10:37:17 -0700 Subject: [PATCH] [V1] Minor V1 async engine test refactor (#15075) Signed-off-by: andoorve Co-authored-by: andoorve --- tests/v1/engine/test_async_llm.py | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/tests/v1/engine/test_async_llm.py b/tests/v1/engine/test_async_llm.py index 0ff804976ada..da0639678af8 100644 --- a/tests/v1/engine/test_async_llm.py +++ b/tests/v1/engine/test_async_llm.py @@ -76,21 +76,18 @@ async def generate(engine: AsyncLLM, @pytest.mark.parametrize( "output_kind", [RequestOutputKind.DELTA, RequestOutputKind.FINAL_ONLY]) -@pytest.mark.parametrize("engine_args_and_prompt", +@pytest.mark.parametrize("engine_args,prompt", [(TEXT_ENGINE_ARGS, TEXT_PROMPT), (VISION_ENGINE_ARGS, VISION_PROMPT)]) @pytest.mark.asyncio -async def test_load( - monkeypatch: pytest.MonkeyPatch, - output_kind: RequestOutputKind, - engine_args_and_prompt: tuple[AsyncEngineArgs, PromptType], -): +async def test_load(monkeypatch: pytest.MonkeyPatch, + output_kind: RequestOutputKind, + engine_args: AsyncEngineArgs, prompt: PromptType): # TODO(rickyx): Remove monkeypatch once we have a better way to test V1 # so that in the future when we switch, we don't have to change all the # tests. with monkeypatch.context() as m, ExitStack() as after: m.setenv("VLLM_USE_V1", "1") - engine_args, prompt = engine_args_and_prompt engine = AsyncLLM.from_engine_args(engine_args) after.callback(engine.shutdown) @@ -124,18 +121,16 @@ async def test_load( @pytest.mark.parametrize( "output_kind", [RequestOutputKind.DELTA, RequestOutputKind.FINAL_ONLY]) -@pytest.mark.parametrize("engine_args_and_prompt", +@pytest.mark.parametrize("engine_args,prompt", [(TEXT_ENGINE_ARGS, TEXT_PROMPT), (VISION_ENGINE_ARGS, VISION_PROMPT)]) @pytest.mark.asyncio async def test_abort(monkeypatch: pytest.MonkeyPatch, output_kind: RequestOutputKind, - engine_args_and_prompt: tuple[AsyncEngineArgs, - PromptType]): + engine_args: AsyncEngineArgs, prompt: PromptType): with monkeypatch.context() as m, ExitStack() as after: m.setenv("VLLM_USE_V1", "1") - engine_args, prompt = engine_args_and_prompt engine = AsyncLLM.from_engine_args(engine_args) after.callback(engine.shutdown) @@ -193,17 +188,15 @@ async def test_abort(monkeypatch: pytest.MonkeyPatch, @pytest.mark.parametrize("n", [1, 3]) -@pytest.mark.parametrize("engine_args_and_prompt", +@pytest.mark.parametrize("engine_args,prompt", [(TEXT_ENGINE_ARGS, TEXT_PROMPT), (VISION_ENGINE_ARGS, VISION_PROMPT)]) @pytest.mark.asyncio -async def test_finished_flag(monkeypatch, n: int, - engine_args_and_prompt: tuple[AsyncEngineArgs, - PromptType]): +async def test_finished_flag(monkeypatch: pytest.MonkeyPatch, n: int, + engine_args: AsyncEngineArgs, prompt: PromptType): with monkeypatch.context() as m, ExitStack() as after: m.setenv("VLLM_USE_V1", "1") - engine_args, prompt = engine_args_and_prompt engine = AsyncLLM.from_engine_args(engine_args) after.callback(engine.shutdown)