mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-23 20:26:28 +00:00
The test was using setattr() to set module-level attributes (including proxy_logging_obj = MagicMock()) on the real litellm.proxy.proxy_server module, but the finally block only had `pass` — no cleanup. This left proxy_logging_obj as a MagicMock in subsequent tests running in the same pytest-xdist worker, causing TypeError when log_db_metrics decorator called asyncio.create_task(proxy_logging_obj.service_logging_obj .async_service_success_hook(...)) — a MagicMock is not a coroutine. Fix: save original attribute values before the test and restore them in the finally block to ensure test isolation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>