[Fix] CI: fix 6 more CircleCI job failures from uv migration

1. check_code_and_doc_quality: add PLR0915 ignore for sandbox_executor.py
2. auth_ui_unit_tests: add prisma generate step (entrypoint.sh only runs
   migration, not client generation)
3. proxy_store_model_in_db_tests: move does_mcp_server_exist outside
   `if MCP_AVAILABLE:` so it's importable on Python < 3.10
4. build_and_test: fix datetime.fromisoformat('...Z') on Python 3.9
   (Z suffix support was added in 3.11)
5. proxy_logging_guardrails: fix container name typo my-app-2 -> my-app-3
6. upload-coverage: use `uv tool run` instead of `uv run --with` to avoid
   resolving the full workspace (which fails for Python 3.14)
This commit is contained in:
Yuneng Jiang 2026-04-10 21:06:25 -07:00
parent 93d340c1ad
commit 491aa7ea51
No known key found for this signature in database
4 changed files with 28 additions and 18 deletions

View File

@ -420,6 +420,9 @@ jobs:
chmod +x docker/entrypoint.sh
./docker/entrypoint.sh
set -e
- run:
name: Generate Prisma Client
command: uv run --no-sync python -m prisma generate
# Run pytest and generate JUnit XML report
- run:
name: Run tests
@ -2161,7 +2164,7 @@ jobs:
- run:
name: Start outputting logs for second container
command: docker logs -f my-app-2
command: docker logs -f my-app-3
background: true
- run:
@ -2962,8 +2965,8 @@ jobs:
rm -f /tmp/uv-install.sh
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$BASH_ENV"
export PATH="$HOME/.local/bin:$PATH"
uv run --with 'coverage[toml]==7.10.6' coverage combine realtime_translation_coverage ocr_coverage search_coverage mcp_coverage litellm_mcps_tests_coverage logging_coverage audio_coverage local_testing_part1_coverage local_testing_part2_coverage pass_through_unit_tests_coverage batches_coverage guardrails_coverage redis_caching_coverage
uv run --with 'coverage[toml]==7.10.6' coverage xml
uv tool run --from 'coverage[toml]==7.10.6' coverage combine realtime_translation_coverage ocr_coverage search_coverage mcp_coverage litellm_mcps_tests_coverage logging_coverage audio_coverage local_testing_part1_coverage local_testing_part2_coverage pass_through_unit_tests_coverage batches_coverage guardrails_coverage redis_caching_coverage
uv tool run --from 'coverage[toml]==7.10.6' coverage xml
- codecov/upload:
file: ./coverage.xml

View File

@ -58,6 +58,21 @@ router = APIRouter(prefix="/v1/mcp", tags=["mcp"])
MCP_AVAILABLE: bool = True
TEMPORARY_MCP_SERVER_TTL_SECONDS = 300
def does_mcp_server_exist(
mcp_server_records: Iterable[Any], mcp_server_id: str
) -> bool:
"""
Check if the mcp server with the given id exists in the iterable of mcp servers.
Defined at module level (outside ``if MCP_AVAILABLE``) so it can be imported
on Python < 3.10 where the ``mcp`` package is unavailable.
"""
for mcp_server_record in mcp_server_records:
if mcp_server_record.server_id == mcp_server_id:
return True
return False
DEFAULT_MCP_REGISTRY_VERSION = "1.0.0"
LITELLM_MCP_SERVER_NAME = "litellm-mcp-server"
LITELLM_MCP_SERVER_DESCRIPTION = "MCP Server for LiteLLM"
@ -503,17 +518,6 @@ if MCP_AVAILABLE:
)
return prisma_client
def does_mcp_server_exist(
mcp_server_records: Iterable[LiteLLM_MCPServerTable], mcp_server_id: str
) -> bool:
"""
Check if the mcp server with the given id exists in the iterable of mcp servers
"""
for mcp_server_record in mcp_server_records:
if mcp_server_record.server_id == mcp_server_id:
return True
return False
# Router to fetch all MCP tools available for the current key
@router.get(

View File

@ -18,3 +18,4 @@ exclude = ["litellm/types/*", "litellm/__init__.py", "litellm/proxy/example_conf
"litellm/proxy/guardrails/guardrail_hooks/guardrail_benchmarks/test_eval.py" = ["PLR0915"]
"litellm/responses/streaming_iterator.py" = ["PLR0915"]
"litellm/files/main.py" = ["PLR0915"]
"litellm/llms/litellm_proxy/skills/sandbox_executor.py" = ["PLR0915"]

View File

@ -73,13 +73,15 @@ async def test_create_budget_with_duration(budget_setup):
), "The budget_reset_at field should not be None"
# Calculate the expected reset time: created_at + 1 day.
expected_reset_at_date = datetime.fromisoformat(
budget_setup["created_at"]
) + timedelta(days=1)
# Replace trailing 'Z' with '+00:00' for Python 3.9 compat (fromisoformat
# only learned to accept 'Z' in Python 3.11).
created_at_str = budget_setup["created_at"].replace("Z", "+00:00")
expected_reset_at_date = datetime.fromisoformat(created_at_str) + timedelta(days=1)
# Allow for a small tolerance in seconds for the timestamp calculation.
tolerance_seconds = 3
actual_reset_at_date = datetime.fromisoformat(budget_setup["budget_reset_at"])
reset_at_str = budget_setup["budget_reset_at"].replace("Z", "+00:00")
actual_reset_at_date = datetime.fromisoformat(reset_at_str)
time_difference = abs(
(actual_reset_at_date - expected_reset_at_date).total_seconds()
)