From 0be90428f524c70bca72cc0c0514ba9296c19485 Mon Sep 17 00:00:00 2001 From: shivam Date: Wed, 30 Sep 2026 22:14:08 +0000 Subject: [PATCH] test(llms): keep the lookup handler raise block to a single statement Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- tests/unit/llms/custom_httpx/test_llm_http_handler.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/unit/llms/custom_httpx/test_llm_http_handler.py b/tests/unit/llms/custom_httpx/test_llm_http_handler.py index 951edecadef..7f1ca2ff6d0 100644 --- a/tests/unit/llms/custom_httpx/test_llm_http_handler.py +++ b/tests/unit/llms/custom_httpx/test_llm_http_handler.py @@ -1,5 +1,6 @@ import asyncio import base64 +import inspect import json import logging import threading @@ -4425,6 +4426,11 @@ def _call_lookup_handler(name: str, is_async: bool, client: HTTPHandler | AsyncH ) +async def _run_lookup_handler(name: str, is_async: bool, client: HTTPHandler | AsyncHTTPHandler) -> object: + result: Final = _call_lookup_handler(name, is_async, client) + return await result if inspect.isawaitable(result) else result + + @pytest.mark.asyncio @pytest.mark.parametrize( "name", @@ -4445,9 +4451,7 @@ async def test_lookup_handlers_raise_the_provider_error_status(name: str, is_asy ) with pytest.raises(BaseLLMException) as error: - result: Final = _call_lookup_handler(name, is_async, async_client if is_async else sync_client) - if is_async: - await result + await _run_lookup_handler(name, is_async, async_client if is_async else sync_client) assert error.value.status_code == status_code assert "No such object" in error.value.message