From 37be82e45e5635760ee13d73efd3b2c2b9a516c1 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Mon, 28 Sep 2026 12:20:20 -0700 Subject: [PATCH] test(unit): stop test modules from putting their own directory on sys.path (#43421) test_ssl_verify_unit.py inserted tests/unit at the front of sys.path, so any later import of litellm_proxy_extras resolved to the tests/unit/litellm_proxy_extras test package. Whenever the CircleCI shard split collected that file before test_litellm_proxy_extras_logging.py, collection failed with ModuleNotFoundError. test_gemini_session_leak.py had the same insert for its own directory --- tests/unit/llms/custom_httpx/test_gemini_session_leak.py | 4 ---- tests/unit/test_ssl_verify_unit.py | 5 ----- 2 files changed, 9 deletions(-) diff --git a/tests/unit/llms/custom_httpx/test_gemini_session_leak.py b/tests/unit/llms/custom_httpx/test_gemini_session_leak.py index 9a4c6164db6..6483fcaa389 100755 --- a/tests/unit/llms/custom_httpx/test_gemini_session_leak.py +++ b/tests/unit/llms/custom_httpx/test_gemini_session_leak.py @@ -11,13 +11,9 @@ Validates that: import asyncio import gc import sys -from pathlib import Path import pytest -# Add litellm to path -sys.path.insert(0, str(Path(__file__).parent)) - async def test_aiohttp_handler_cleanup(): """Test BaseLLMAIOHTTPHandler session cleanup via __del__""" diff --git a/tests/unit/test_ssl_verify_unit.py b/tests/unit/test_ssl_verify_unit.py index f47cdf3e6cd..5384414e18e 100644 --- a/tests/unit/test_ssl_verify_unit.py +++ b/tests/unit/test_ssl_verify_unit.py @@ -5,15 +5,10 @@ These tests verify that ssl_verify parameters are correctly propagated through the call stack without requiring live API credentials. """ -import sys -from pathlib import Path from unittest.mock import Mock, patch import pytest -# Add litellm to path -sys.path.insert(0, str(Path(__file__).parent)) - import litellm.proxy.guardrails.guardrail_hooks.aim.aim as _aim_module import litellm.proxy.guardrails.guardrail_hooks.cato_networks.cato_networks as _cato_networks_module from litellm.llms.bedrock.base_aws_llm import BaseAWSLLM