From 58a9f56f83d79751bef6656467d96fec129c1d7d Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Sat, 21 Feb 2026 11:27:39 -0800 Subject: [PATCH] fix(tests): clear app.openapi_schema in TestSwaggerChatCompletions setup/teardown --- .../test_litellm/proxy/test_swagger_chat_completions.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_litellm/proxy/test_swagger_chat_completions.py b/tests/test_litellm/proxy/test_swagger_chat_completions.py index 968443ef4d7..1807f5956e2 100644 --- a/tests/test_litellm/proxy/test_swagger_chat_completions.py +++ b/tests/test_litellm/proxy/test_swagger_chat_completions.py @@ -17,6 +17,12 @@ from litellm.proxy.proxy_server import app class TestSwaggerChatCompletions: """Test suite for validating /chat/completions schema in Swagger documentation.""" + def setup_method(self): + app.openapi_schema = None + + def teardown_method(self): + app.openapi_schema = None + @pytest.fixture def client(self): """FastAPI test client for the proxy server.""" @@ -315,7 +321,8 @@ class TestSwaggerChatCompletions: This ensures Swagger UI works correctly with reverse proxies and subpath deployments. """ from unittest.mock import patch - from litellm.proxy.proxy_server import get_openapi_schema, custom_openapi, app + + from litellm.proxy.proxy_server import app, custom_openapi, get_openapi_schema # Test cases: (server_root_path, expected_servers_url) # Note: empty string is falsy in Python, so servers won't be set