All new functionality must include mock tests placed in the tests/litellm/ directory structure. Mock external API calls and dependencies rather than requiring real credentials or external services. This ensures tests can run reliably in CI/CD pipelines and are accessible to all contributors.

Key Requirements:

Example:

# Good: Mock test in tests/litellm/
from unittest.mock import patch, MagicMock
import pytest
from litellm import completion

def test_provider_completion_mock():
    mock_response = MagicMock()
    mock_response.json.return_value = {
        "choices": [{"message": {"content": "Hello"}}]
    }
    
    with patch("requests.post", return_value=mock_response):
        response = completion(
            model="provider/model-name",
            messages=[{"role": "user", "content": "Hi"}]
        )
        assert response.choices[0].message.content == "Hello"

# Bad: Integration test requiring real credentials
def test_provider_completion_real():
    # Requires PROVIDER_API_KEY environment variable
    response = completion(
        model="provider/model-name", 
        messages=[{"role": "user", "content": "Hi"}]
    )

This approach prevents test failures due to missing credentials, network issues, or rate limits, while ensuring comprehensive test coverage that contributors can run locally and in automated pipelines.