mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-21 08:26:34 +00:00
Merge pull request #21669 from BerriAI/fix/skip-tests-requiring-external-services
fix(tests): skip CI tests requiring external services (DB, API keys)
This commit is contained in:
@@ -301,6 +301,7 @@ def team_token_tuple():
|
||||
return team_id, token, public_jwk
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
@pytest.mark.parametrize("audience", [None, "litellm-proxy"])
|
||||
@pytest.mark.asyncio
|
||||
async def test_team_token_output(prisma_client, audience, monkeypatch):
|
||||
|
||||
@@ -299,6 +299,7 @@ def test_generate_and_call_with_valid_key(prisma_client, api_route):
|
||||
pytest.fail(f"An exception occurred - {str(e)}")
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
def test_call_with_invalid_key(prisma_client):
|
||||
# 2. Make a call with invalid key, expect it to fail
|
||||
setattr(litellm.proxy.proxy_server, "prisma_client", prisma_client)
|
||||
@@ -326,6 +327,7 @@ def test_call_with_invalid_key(prisma_client):
|
||||
pass
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
def test_call_with_invalid_model(prisma_client):
|
||||
litellm.set_verbose = True
|
||||
# 3. Make a call to a key with an invalid model - expect to fail
|
||||
@@ -573,6 +575,7 @@ def test_end_user_cache_write_unit_test():
|
||||
pass
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
def test_call_with_end_user_over_budget(prisma_client):
|
||||
# Test if a user passed to /chat/completions is tracked & fails when they cross their budget
|
||||
# we only check this when litellm.max_end_user_budget is set
|
||||
@@ -1771,6 +1774,7 @@ def test_call_with_key_over_budget_no_cache(prisma_client):
|
||||
print(vars(e))
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
@pytest.mark.asyncio()
|
||||
@pytest.mark.parametrize(
|
||||
"request_model,should_pass",
|
||||
@@ -1918,6 +1922,7 @@ async def test_aasync_call_with_key_over_model_budget(
|
||||
raise
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
@pytest.mark.asyncio()
|
||||
async def test_call_with_key_never_over_budget(prisma_client):
|
||||
# Make a call with a key with budget=None, it should never fail
|
||||
@@ -2101,6 +2106,7 @@ async def test_call_with_key_over_budget_stream(prisma_client):
|
||||
print(vars(e))
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
@pytest.mark.asyncio()
|
||||
async def test_aview_spend_per_user(prisma_client):
|
||||
setattr(litellm.proxy.proxy_server, "prisma_client", prisma_client)
|
||||
@@ -3422,6 +3428,7 @@ async def test_team_tags(prisma_client):
|
||||
assert team_info_response["team_info"].metadata["tags"] == ["teamA", "teamB"]
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
@pytest.mark.asyncio
|
||||
async def test_aadmin_only_routes(prisma_client):
|
||||
"""
|
||||
@@ -3677,6 +3684,7 @@ async def test_key_aliases(prisma_client):
|
||||
assert aliases == sorted(aliases)
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
@pytest.mark.asyncio
|
||||
async def test_auth_vertex_ai_route(prisma_client):
|
||||
"""
|
||||
|
||||
@@ -73,6 +73,7 @@ def prisma_client():
|
||||
return prisma_client
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
@pytest.mark.asyncio
|
||||
async def test_new_project(prisma_client):
|
||||
"""
|
||||
@@ -144,6 +145,7 @@ async def test_new_project(prisma_client):
|
||||
pytest.fail(f"Got exception {e}")
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
@pytest.mark.asyncio
|
||||
async def test_update_project(prisma_client):
|
||||
"""
|
||||
@@ -248,6 +250,7 @@ async def test_update_project(prisma_client):
|
||||
pytest.fail(f"Got exception {e}")
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete_project(prisma_client):
|
||||
"""
|
||||
@@ -337,6 +340,7 @@ async def test_delete_project(prisma_client):
|
||||
pytest.fail(f"Got exception {e}")
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
@pytest.mark.asyncio
|
||||
async def test_project_info(prisma_client):
|
||||
"""
|
||||
|
||||
@@ -1029,6 +1029,7 @@ from litellm.proxy.management_endpoints.team_endpoints import team_member_add
|
||||
from test_key_generate_prisma import prisma_client
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
@pytest.mark.parametrize(
|
||||
"user_role",
|
||||
[LitellmUserRoles.INTERNAL_USER.value, LitellmUserRoles.PROXY_ADMIN.value],
|
||||
@@ -1910,6 +1911,10 @@ async def test_add_callback_via_key_litellm_pre_call_utils_langsmith(
|
||||
assert new_data["failure_callback"] == expected_failure_callbacks
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not os.getenv("GEMINI_API_KEY") and not os.getenv("GOOGLE_API_KEY"),
|
||||
reason="Requires GEMINI_API_KEY or GOOGLE_API_KEY.",
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
async def test_gemini_pass_through_endpoint():
|
||||
from starlette.datastructures import URL
|
||||
|
||||
@@ -682,6 +682,9 @@ async def test_factory_registration():
|
||||
assert not counter.should_use_token_counting_api(custom_llm_provider=None)
|
||||
|
||||
|
||||
@pytest.mark.skip(
|
||||
reason="Requires Google/Vertex AI credentials (GEMINI_API_KEY or VERTEX_AI_PRIVATE_KEY)."
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize("model_name", ["gemini-2.5-pro", "vertex-ai-gemini-2.5-pro"])
|
||||
async def test_vertex_ai_gemini_token_counting_with_contents(model_name):
|
||||
|
||||
@@ -80,6 +80,7 @@ def prisma_client():
|
||||
return prisma_client
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
@pytest.mark.asyncio
|
||||
async def test_create_skill_sdk(prisma_client):
|
||||
"""
|
||||
@@ -120,6 +121,7 @@ async def test_create_skill_sdk(prisma_client):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_skills_sdk(prisma_client):
|
||||
"""
|
||||
@@ -170,6 +172,7 @@ async def test_list_skills_sdk(prisma_client):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_skill_sdk(prisma_client):
|
||||
"""
|
||||
@@ -211,6 +214,7 @@ async def test_get_skill_sdk(prisma_client):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Requires reliable external DB connection (prisma).")
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete_skill_sdk(prisma_client):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user