From ffc29e50a455bd51f40d740d140d45c03cf1a7be Mon Sep 17 00:00:00 2001 From: ElDjeee Date: Mon, 6 Jul 2026 16:25:21 +0200 Subject: [PATCH] test(mistral): drop key-skip guards so web search tests replay under VCR Every test in tests/llm_translation/ is auto-decorated with pytest.mark.vcr and replays from the Redis cassette cache without provider credentials; the MISTRAL_API_KEY skip guards opted these three tests out of that replay, so keyless CI runs got no regression signal from them. Removing the guards matches the rest of the folder (BaseLLMChatTest and recent provider tests carry no key guards) and turns the silent skip into either a cassette replay or a loud failure Also drop the manual LITELLM_LOCAL_MODEL_COST_MAP/model_cost reload and debug toggle (the folder conftest already pins the local cost map and reloads litellm per test) and assert supports_web_search directly so removing the capability flag from the pricing JSON fails the test instead of silently skipping it --- tests/llm_translation/test_mistral_api.py | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/tests/llm_translation/test_mistral_api.py b/tests/llm_translation/test_mistral_api.py index fd1dfb29315..6d7faceeb5d 100644 --- a/tests/llm_translation/test_mistral_api.py +++ b/tests/llm_translation/test_mistral_api.py @@ -36,18 +36,8 @@ class TestMistralCompletion(BaseLLMChatTest): """Web search is routed to the Conversations API for models that support it""" from litellm.utils import supports_web_search - if not os.getenv("MISTRAL_API_KEY"): - pytest.skip("MISTRAL_API_KEY not set") - - os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True" - litellm.model_cost = litellm.get_model_cost_map(url="") - - litellm._turn_on_debug() - model = "mistral/mistral-medium-latest" - - if not supports_web_search(model, None): - pytest.skip("Model does not support web search") + assert supports_web_search(model, None) response = litellm.completion( model=model, @@ -56,15 +46,12 @@ class TestMistralCompletion(BaseLLMChatTest): max_tokens=100, ) - assert response is not None + assert response.choices[0].message.content def test_web_search_with_tool_call_history(self): """The Conversations API accepts prior function-call history mapped to function.call / function.result input entries alongside a web search request (a 400 here means the mapped wire schema is wrong).""" - if not os.getenv("MISTRAL_API_KEY"): - pytest.skip("MISTRAL_API_KEY not set") - response = litellm.completion( model="mistral/mistral-medium-latest", messages=[ @@ -87,16 +74,12 @@ class TestMistralCompletion(BaseLLMChatTest): max_tokens=200, ) - assert response is not None assert response.choices[0].message.content def test_web_search_truncation_reports_length(self): """The Conversations API returns no finish reason, so truncation is inferred from the token budget. Force a real truncation (max_tokens=1 with an overflowing prompt) and assert the response reports finish_reason='length'.""" - if not os.getenv("MISTRAL_API_KEY"): - pytest.skip("MISTRAL_API_KEY not set") - response = litellm.completion( model="mistral/mistral-medium-latest", messages=[