mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-27 18:20:57 +00:00
Three test isolation issues fixed: 1. test_mcp_debug.py: Replace deprecated asyncio.get_event_loop().run_until_complete() with asyncio.run() in TestWrapSendWithDebugHeaders. In Python 3.10+, get_event_loop() raises RuntimeError when no event loop is set in the current thread, causing test_injects_headers and test_body_messages_unchanged to fail in isolation. 2. test_mcp_server_manager.py: After _reload_mcp_manager_module() creates a new global_mcp_server_manager instance, server.py still holds a stale reference to the old instance. Tests in test_mcp_server.py that populate the new manager's registry and then call server.py functions (e.g. _get_tools_from_mcp_servers) get empty results because server.py reads from the old manager. Fix: update server.py's module-level reference after each reload. 3. test_litellm_pre_call_utils.py: test_add_litellm_metadata_from_request_headers sets litellm.callbacks without restoring it afterward. Add cleanup to restore original callbacks after the test to prevent state leaking to subsequent tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
In total litellm runs 1000+ tests
[02/20/2025] Update:
To make it easier to contribute and map what behavior is tested,
we've started mapping the litellm directory in tests/test_litellm
This folder can only run mock tests.