From bc05219ba92758e233165b2267cc974149a002ef Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Fri, 10 Apr 2026 21:32:22 -0700 Subject: [PATCH] [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 --- .circleci/config.yml | 4 ++++ tests/store_model_in_db_tests/test_mcp_servers.py | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1f2795bfcac..8883e3c1815 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: diff --git a/tests/store_model_in_db_tests/test_mcp_servers.py b/tests/store_model_in_db_tests/test_mcp_servers.py index a369cce83c0..49a9625227d 100644 --- a/tests/store_model_in_db_tests/test_mcp_servers.py +++ b/tests/store_model_in_db_tests/test_mcp_servers.py @@ -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(