A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 10, 00:15 UTC
[CI/Build] Use Common Event Map Fixture in Harmony / MCP Server Tests (#32531)
Signed-off-by: Alex-Brooks <Alex.Brooks@ibm.com>
Alex Brooks committed
Jan 18, 2026 at 21:05 UTC
7518a3dc65e4c20860ca97464e62ee9b02c0c578
3 files changed
+40
-39
tests/entrypoints/openai/responses/conftest.py
new
+30
@@ -0,0 +1,30 @@
1
+# SPDX-License-Identifier: Apache-2.0
2
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
+import pytest
4
+
5
+
6
+@pytest.fixture
7
+def pairs_of_event_types() -> dict[str, str]:
8
+ """Links the 'done' event type with the corresponding 'start' event type.
9
+
10
+ This mapping should link all done <-> start events; if tests mean to
11
+ restrict the allowed events, they should filter this fixture to avoid
12
+ copy + paste errors in the mappings or unexpected KeyErrors due to missing
13
+ events.
14
+ """
15
+ # fmt: off
16
+ event_pairs = {
17
+ "response.completed": "response.created",
18
+ "response.output_item.done": "response.output_item.added",
19
+ "response.content_part.done": "response.content_part.added",
20
+ "response.output_text.done": "response.output_text.delta",
21
+ "response.reasoning_text.done": "response.reasoning_text.delta",
22
+ "response.reasoning_part.done": "response.reasoning_part.added",
23
+ "response.mcp_call_arguments.done": "response.mcp_call_arguments.delta",
24
+ "response.mcp_call.completed": "response.mcp_call.in_progress",
25
+ "response.function_call_arguments.done": "response.function_call_arguments.delta", # noqa: E501
26
+ "response.code_interpreter_call_code.done": "response.code_interpreter_call_code.delta", # noqa: E501
27
+ "response.web_search_call.completed": "response.web_search_call.in_progress",
28
+ }
29
+ # fmt: on
30
+ return event_pairs
tests/entrypoints/openai/responses/test_harmony.py
+6
-27
@@ -280,24 +280,13 @@ async def test_stateful_multi_turn(client: OpenAI, model_name: str):
280
281
@pytest.mark.asyncio
282
@pytest.mark.parametrize("model_name", [MODEL_NAME])
283
-async def test_streaming_types(client: OpenAI, model_name: str):
283
+async def test_streaming_types(
284
+ pairs_of_event_types: dict[str, str], client: OpenAI, model_name: str
285
+):
286
prompts = [
287
"tell me a story about a cat in 20 words",
288
]
289
288
- # this links the "done" type with the "start" type
289
- # so every "done" type should have a corresponding "start" type
290
- # and every open block should be closed by the end of the stream
291
- pairs_of_event_types = {
292
- "response.completed": "response.created",
293
- "response.output_item.done": "response.output_item.added",
294
- "response.content_part.done": "response.content_part.added",
295
- "response.output_text.done": "response.output_text.delta",
296
- "response.web_search_call.done": "response.web_search_call.added",
297
- "response.reasoning_text.done": "response.reasoning_text.delta",
298
- "response.reasoning_part.done": "response.reasoning_part.added",
299
- }
300
-
290
for prompt in prompts:
291
response = await client.responses.create(
292
model=model_name,
@@ -329,19 +318,9 @@ async def test_streaming_types(client: OpenAI, model_name: str):
318
319
@pytest.mark.asyncio
320
@pytest.mark.parametrize("model_name", [MODEL_NAME])
332
-async def test_function_calling_with_streaming_types(client: OpenAI, model_name: str):
333
- # this links the "done" type with the "start" type
334
- # so every "done" type should have a corresponding "start" type
335
- # and every open block should be closed by the end of the stream
336
- pairs_of_event_types = {
337
- "response.completed": "response.created",
338
- "response.output_item.done": "response.output_item.added",
339
- "response.output_text.done": "response.output_text.delta",
340
- "response.reasoning_text.done": "response.reasoning_text.delta",
341
- "response.reasoning_part.done": "response.reasoning_part.added",
342
- "response.function_call_arguments.done": "response.function_call_arguments.delta", # noqa
343
- }
344
-
321
+async def test_function_calling_with_streaming_types(
322
+ pairs_of_event_types: dict[str, str], client: OpenAI, model_name: str
323
+):
324
tools = [GET_WEATHER_SCHEMA]
325
input_list = [
326
{
tests/entrypoints/openai/responses/test_mcp_tools.py
+4
-12
@@ -210,19 +210,11 @@ class TestMCPEnabled:
210
@pytest.mark.asyncio
211
@pytest.mark.parametrize("model_name", [MODEL_NAME])
212
async def test_mcp_tool_calling_streaming_types(
213
- self, mcp_enabled_client: OpenAI, model_name: str
213
+ self,
214
+ pairs_of_event_types: dict[str, str],
215
+ mcp_enabled_client: OpenAI,
216
+ model_name: str,
217
):
215
- pairs_of_event_types = {
216
- "response.completed": "response.created",
217
- "response.output_item.done": "response.output_item.added",
218
- "response.content_part.done": "response.content_part.added",
219
- "response.output_text.done": "response.output_text.delta",
220
- "response.reasoning_text.done": "response.reasoning_text.delta",
221
- "response.reasoning_part.done": "response.reasoning_part.added",
222
- "response.mcp_call_arguments.done": ("response.mcp_call_arguments.delta"),
223
- "response.mcp_call.completed": "response.mcp_call.in_progress",
224
- }
225
-
218
tools = [
219
{
220
"type": "mcp",