[Fix] CI: fix helm not found and MCP tests on Python 3.9

1. check_code_and_doc_quality: install helm before running helm lint
   (Docker image cimg/python:3.11 doesn't include helm)
2. proxy_store_model_in_db_tests: skip MCP tests on Python < 3.10
   since MCP module isn't available and functions inside the
   `if MCP_AVAILABLE:` block don't exist as module-level attributes
This commit is contained in:
Yuneng Jiang 2026-04-10 21:32:22 -07:00
parent 491aa7ea51
commit bc05219ba9
No known key found for this signature in database
2 changed files with 18 additions and 0 deletions

View file

@ -1645,6 +1645,10 @@ jobs:
- run: uv run --no-sync python ./tests/code_coverage_tests/ban_copy_deepcopy_kwargs.py
- run: uv run --no-sync python ./tests/code_coverage_tests/check_fastuuid_usage.py
- run: uv run --no-sync python ./tests/code_coverage_tests/memory_test.py
- run:
name: Install Helm
command: |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- run: helm lint ./deploy/charts/litellm-helm
db_migration_disable_update_check:

View file

@ -1,3 +1,4 @@
import sys
from datetime import datetime
from typing import List, Optional
import pytest
@ -8,6 +9,14 @@ from unittest import mock
from fastapi.testclient import TestClient
from fastapi import FastAPI
# MCP requires Python >= 3.10. Tests that mock functions defined inside the
# ``if MCP_AVAILABLE`` block cannot run on older interpreters because those
# module-level names simply don't exist.
_SKIP_NO_MCP = pytest.mark.skipif(
sys.version_info < (3, 10),
reason="MCP requires Python >= 3.10",
)
from starlette import status
from litellm.constants import LITELLM_PROXY_ADMIN_NAME
@ -109,6 +118,7 @@ def test_does_mcp_server_exist():
assert False == does_mcp_server_exist(mcp_server_records, not_found_record)
@_SKIP_NO_MCP
@pytest.mark.asyncio
async def test_create_mcp_server_direct():
"""
@ -198,6 +208,7 @@ async def test_create_mcp_server_direct():
mock_manager.add_server.assert_called_once_with(expected_response)
@_SKIP_NO_MCP
@pytest.mark.asyncio
async def test_create_duplicate_mcp_server():
"""
@ -258,6 +269,7 @@ async def test_create_duplicate_mcp_server():
assert "already exists" in str(exc_info.value.detail)
@_SKIP_NO_MCP
@pytest.mark.asyncio
async def test_create_mcp_server_auth_failure():
"""
@ -302,6 +314,7 @@ async def test_create_mcp_server_auth_failure():
assert "permission" in str(exc_info.value.detail)
@_SKIP_NO_MCP
@pytest.mark.asyncio
async def test_create_mcp_server_invalid_alias():
"""
@ -356,6 +369,7 @@ async def test_create_mcp_server_invalid_alias():
)
@_SKIP_NO_MCP
@pytest.mark.asyncio
async def test_edit_mcp_server_redacts_credentials():
with mock.patch(