mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
Merge pull request #21273 from BerriAI/fix/vertex-ai-qwen-test-isolation
fix(test): add environment cleanup for Vertex AI Qwen tests
This commit is contained in:
commit
03215c6495
1 changed files with 24 additions and 0 deletions
|
|
@ -24,6 +24,30 @@ from litellm.llms.vertex_ai.vertex_llm_base import VertexBase
|
|||
from litellm.types.llms.vertex_ai import VertexPartnerProvider
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def clean_vertex_env():
|
||||
"""Clear Google/Vertex AI environment variables before each test to prevent test isolation issues."""
|
||||
saved_env = {}
|
||||
env_vars_to_clear = [
|
||||
"GOOGLE_APPLICATION_CREDENTIALS",
|
||||
"GOOGLE_CLOUD_PROJECT",
|
||||
"VERTEXAI_PROJECT",
|
||||
"VERTEX_PROJECT",
|
||||
"VERTEX_LOCATION",
|
||||
"VERTEX_AI_PROJECT",
|
||||
]
|
||||
for var in env_vars_to_clear:
|
||||
if var in os.environ:
|
||||
saved_env[var] = os.environ[var]
|
||||
del os.environ[var]
|
||||
|
||||
yield
|
||||
|
||||
# Restore saved environment variables
|
||||
for var, value in saved_env.items():
|
||||
os.environ[var] = value
|
||||
|
||||
|
||||
class TestQwenGlobalOnlyDetection:
|
||||
"""Test that Qwen models are correctly identified as global-only."""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue