fix: cleanup tests

This commit is contained in:
Krrish Dholakia
2026-03-30 16:24:35 -07:00
parent 7b532fda66
commit c7e2bfc577
7 changed files with 16 additions and 51 deletions
+8 -31
View File
@@ -406,29 +406,6 @@ def test_convert_basic_openai_request_to_vertex_request():
)
@pytest.mark.asyncio()
@pytest.mark.skip(reason="skipping - we run mock tests for vertex ai")
async def test_create_vertex_fine_tune_jobs():
verbose_logger.setLevel(logging.DEBUG)
# load_vertex_ai_credentials()
vertex_credentials = os.getenv("GCS_PATH_SERVICE_ACCOUNT")
print("creating fine tuning job")
create_fine_tuning_response = await litellm.acreate_fine_tuning_job(
model="gemini-1.0-pro-002",
custom_llm_provider="vertex_ai",
training_file="gs://cloud-samples-data/ai-platform/generative_ai/sft_train_data.jsonl",
vertex_project="pathrise-convert-1606954137718",
vertex_location="us-central1",
vertex_credentials=vertex_credentials,
)
print("vertex ai create fine tuning response=", create_fine_tuning_response)
assert create_fine_tuning_response.id is not None
assert create_fine_tuning_response.model == "gemini-1.0-pro-002"
assert create_fine_tuning_response.object == "fine_tuning.job"
@pytest.mark.asyncio
async def test_mock_openai_create_fine_tune_job():
"""Test that create_fine_tuning_job sends correct parameters to OpenAI"""
@@ -536,7 +513,6 @@ async def test_mock_openai_retrieve_fine_tune_job():
except Exception as e:
print("error=", e)
# Verify the request
mock_retrieve.assert_called_once_with(fine_tuning_job_id="ft-123")
@@ -544,7 +520,9 @@ async def test_mock_openai_retrieve_fine_tune_job():
@pytest.mark.asyncio
async def test_mock_azure_create_fine_tune_job_with_azure_specific_params():
"""Test that Azure-specific parameters are passed through extra_body"""
from openai.types.fine_tuning.fine_tuning_job import Hyperparameters as OAIHyperparameters
from openai.types.fine_tuning.fine_tuning_job import (
Hyperparameters as OAIHyperparameters,
)
from litellm.types.utils import LiteLLMFineTuningJob
mock_response = LiteLLMFineTuningJob(
@@ -564,7 +542,9 @@ async def test_mock_azure_create_fine_tune_job_with_azure_specific_params():
async def mock_async_create(*args, **kwargs):
return mock_response
with patch("litellm.llms.azure.fine_tuning.handler.AzureOpenAIFineTuningAPI.create_fine_tuning_job") as mock_create:
with patch(
"litellm.llms.azure.fine_tuning.handler.AzureOpenAIFineTuningAPI.create_fine_tuning_job"
) as mock_create:
mock_create.return_value = mock_async_create()
response = await litellm.acreate_fine_tuning_job(
@@ -575,10 +555,7 @@ async def test_mock_azure_create_fine_tune_job_with_azure_specific_params():
api_key="test-key",
api_version="2025-04-01-preview",
trainingType=1,
hyperparameters={
"n_epochs": 3,
"prompt_loss_weight": 0.1
},
hyperparameters={"n_epochs": 3, "prompt_loss_weight": 0.1},
)
# Verify the request
@@ -590,7 +567,7 @@ async def test_mock_azure_create_fine_tune_job_with_azure_specific_params():
assert create_data["model"] == "gpt-4.1-mini-2025-04-14"
assert create_data["training_file"] == "file-123"
assert create_data["hyperparameters"] == {"n_epochs": 3}
# Azure-specific parameters should be in extra_body
assert "extra_body" in create_data
assert create_data["extra_body"]["trainingType"] == 1
@@ -54,7 +54,7 @@ def load_vertex_ai_credentials():
print("loading vertex ai credentials")
os.environ["GCS_FLUSH_INTERVAL"] = "1"
filepath = os.path.dirname(os.path.abspath(__file__))
vertex_key_path = filepath + "/pathrise-convert-1606954137718.json"
vertex_key_path = filepath + "/vertex_key.json"
# Read the existing content of the file or create an empty dictionary
try:
@@ -113,7 +113,7 @@ class TestVertexImageGeneration(BaseImageGenTest):
litellm.in_memory_llm_clients_cache = InMemoryCache()
return {
"model": "vertex_ai/imagen-3.0-fast-generate-001",
"vertex_ai_project": "pathrise-convert-1606954137718",
"vertex_ai_project": "litellm-ci-cd",
"vertex_ai_location": "us-central1",
"n": 1,
}
@@ -129,7 +129,7 @@ class TestVertexAIGeminiImageGeneration(BaseImageGenTest):
litellm.in_memory_llm_clients_cache = InMemoryCache()
return {
"model": "vertex_ai/gemini-2.5-flash-image",
"vertex_ai_project": "pathrise-convert-1606954137718",
"vertex_ai_project": "litellm-ci-cd",
"vertex_ai_location": "us-central1",
"n": 1,
"size": "1024x1024",
@@ -226,7 +226,7 @@ def test_google_secret_manager():
"""
Test that we can get a secret from Google Secret Manager
"""
os.environ["GOOGLE_SECRET_MANAGER_PROJECT_ID"] = "pathrise-convert-1606954137718"
os.environ["GOOGLE_SECRET_MANAGER_PROJECT_ID"] = "litellm-ci-cd"
from litellm.secret_managers.google_secret_manager import GoogleSecretManager
@@ -252,7 +252,7 @@ def test_google_secret_manager_read_in_memory():
from litellm.secret_managers.google_secret_manager import GoogleSecretManager
load_vertex_ai_credentials()
os.environ["GOOGLE_SECRET_MANAGER_PROJECT_ID"] = "pathrise-convert-1606954137718"
os.environ["GOOGLE_SECRET_MANAGER_PROJECT_ID"] = "litellm-ci-cd"
secret_manager = GoogleSecretManager()
secret_manager.cache.cache_dict["UNIQUE_KEY"] = None
secret_manager.cache.cache_dict["UNIQUE_KEY_2"] = "lite-llm"
@@ -337,6 +337,7 @@ def test_get_secret_with_access_mode():
litellm._key_management_settings = KeyManagementSettings()
del os.environ[test_secret_name]
def test_key_management_settings_defaults():
"""
Test that KeyManagementSettings initializes with correct default values.
+1 -1
View File
@@ -24,7 +24,7 @@ from litellm import ( # AuthenticationError,; RateLimitError,; ServiceUnavailab
embedding,
)
litellm.vertex_project = "pathrise-convert-1606954137718"
litellm.vertex_project = "litellm-ci-cd"
litellm.vertex_location = "us-central1"
litellm.num_retries = 0
@@ -37,7 +37,7 @@ class CredentialsWrapper(Credentials):
credentials = CredentialsWrapper(token=LITELLM_PROXY_API_KEY)
vertexai.init(
project="pathrise-convert-1606954137718",
project="litellm-ci-cd",
location="us-central1",
api_endpoint=LITELLM_PROXY_BASE,
credentials=credentials,
@@ -1,13 +0,0 @@
{
"type": "service_account",
"project_id": "pathrise-convert-1606954137718",
"private_key_id": "",
"private_key": "",
"client_email": "test-adroit-crow@pathrise-convert-1606954137718.iam.gserviceaccount.com",
"client_id": "104886546564708740969",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/test-adroit-crow%40pathrise-convert-1606954137718.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}