tests: migrate LLM tests to Settings-based constructor API
Replace the old `model=` / `params=InputParams(...)` style with the new `settings=<Service>.Settings(...)` form across LLM service tests.
This commit is contained in:
@@ -29,7 +29,7 @@ async def test_openai_llm_emits_error_frame_on_timeout():
|
||||
primary LLM times out.
|
||||
"""
|
||||
with patch.object(OpenAILLMService, "create_client"):
|
||||
service = OpenAILLMService(model="gpt-4")
|
||||
service = OpenAILLMService(settings=OpenAILLMService.Settings(model="gpt-4"))
|
||||
service._client = AsyncMock()
|
||||
|
||||
# Track pushed frames and errors
|
||||
@@ -96,7 +96,7 @@ async def test_openai_llm_timeout_still_pushes_end_frame():
|
||||
The finally block should ensure proper cleanup regardless of timeout.
|
||||
"""
|
||||
with patch.object(OpenAILLMService, "create_client"):
|
||||
service = OpenAILLMService(model="gpt-4")
|
||||
service = OpenAILLMService(settings=OpenAILLMService.Settings(model="gpt-4"))
|
||||
service._client = AsyncMock()
|
||||
|
||||
pushed_frames = []
|
||||
@@ -137,7 +137,7 @@ async def test_openai_llm_stream_closed_on_cancellation():
|
||||
import asyncio
|
||||
|
||||
with patch.object(OpenAILLMService, "create_client"):
|
||||
service = OpenAILLMService(model="gpt-4")
|
||||
service = OpenAILLMService(settings=OpenAILLMService.Settings(model="gpt-4"))
|
||||
service._client = AsyncMock()
|
||||
|
||||
# Track if close was called
|
||||
@@ -195,7 +195,7 @@ async def test_openai_llm_emits_error_frame_on_exception():
|
||||
This enables proper error handling for API errors, rate limits, and other failures.
|
||||
"""
|
||||
with patch.object(OpenAILLMService, "create_client"):
|
||||
service = OpenAILLMService(model="gpt-4")
|
||||
service = OpenAILLMService(settings=OpenAILLMService.Settings(model="gpt-4"))
|
||||
service._client = AsyncMock()
|
||||
|
||||
pushed_errors = []
|
||||
@@ -233,7 +233,7 @@ async def test_openai_llm_async_iterator_closed_on_stream_end():
|
||||
See MagicStack/uvloop#699.
|
||||
"""
|
||||
with patch.object(OpenAILLMService, "create_client"):
|
||||
service = OpenAILLMService(model="gpt-4")
|
||||
service = OpenAILLMService(settings=OpenAILLMService.Settings(model="gpt-4"))
|
||||
service._client = AsyncMock()
|
||||
|
||||
# Track if the iterator's aclose was called
|
||||
|
||||
Reference in New Issue
Block a user