test(llms): migrate phase 6 provider unit tests to tests/unit

Migrate 18 provider test files from tests/test_litellm/llms to tests/unit/llms.
194 kept tests move as-is after mutation testing; 1 test deleted
(test_completion_datarobot_with_environment_variables, env-gated no-assert);
the fixture-only fal_ai cost calculator file is removed.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
yuneng 2026-09-20 07:35:23 +00:00
parent 6ef7b86748
commit e1d2789d29
19 changed files with 19 additions and 43 deletions

View file

@ -1,19 +0,0 @@
import pytest
import litellm
from litellm.litellm_core_utils.llm_cost_calc.utils import CostCalculatorUtils
from litellm.llms.fal_ai.cost_calculator import cost_calculator
from litellm.types.utils import ImageObject, ImageResponse
@pytest.fixture(autouse=True)
def _use_local_model_cost_map(monkeypatch):
monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url=""))
litellm.get_model_info.cache_clear()
yield
litellm.get_model_info.cache_clear()
def _image_response(num_images: int = 1) -> ImageResponse:
return ImageResponse(data=[ImageObject(url="https://example.com/img.png") for _ in range(num_images)])

View file

@ -19,6 +19,15 @@ from litellm.types.utils import LlmProviders
from litellm.utils import ProviderConfigManager
@pytest.fixture
def local_model_cost_map(monkeypatch):
monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url=""))
litellm.get_model_info.cache_clear()
yield
litellm.get_model_info.cache_clear()
class TestChatGPTResponsesAPITransformation:
@pytest.mark.parametrize(
"model_name",

View file

@ -78,27 +78,3 @@ def test_completion_datarobot_with_deployment():
except Exception as e:
pytest.fail(f"Error occurred: {e}")
def test_completion_datarobot_with_environment_variables():
"""Allow the test to run with environment variables if they are set for integrations."""
# If keys are not set, the test will be skipped
if os.environ.get("DATAROBOT_API_TOKEN") is None:
return
messages = [
{"role": "user", "content": "What's the weather like in San Francisco?"}
]
try:
response = completion(
model="datarobot/vertex_ai/gemini-1.5-flash-002",
messages=messages,
max_tokens=5,
clientId="custom-model",
)
print(response)
assert response["object"] == "chat.completion"
assert response["model"] == "gemini-1.5-flash-002"
assert len(response["choices"]) == 1
assert len(response["choices"][0]["message"]["content"]) > 0
except Exception as e:
pytest.fail(f"Error occurred: {e}")

View file

@ -7,6 +7,16 @@ import litellm
from litellm._internal_context import pinned_billing_time
from litellm.types.utils import ModelResponse, PromptTokensDetailsWrapper, Usage
@pytest.fixture
def local_model_cost_map(monkeypatch):
monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url=""))
litellm.get_model_info.cache_clear()
yield
litellm.get_model_info.cache_clear()
PEAK_MOMENTS: Final = (
pytest.param(datetime(2026, 9, 22, 8, 0, tzinfo=timezone.utc), id="tuesday-08:00"),
pytest.param(datetime(2026, 9, 25, 9, 59, tzinfo=timezone.utc), id="friday-09:59"),