diff --git a/tests/test_litellm/proxy/hooks/test_proxy_hooks_init.py b/tests/test_litellm/proxy/hooks/test_proxy_hooks_init.py index df4dac7c201..4753b5fdb9b 100644 --- a/tests/test_litellm/proxy/hooks/test_proxy_hooks_init.py +++ b/tests/test_litellm/proxy/hooks/test_proxy_hooks_init.py @@ -81,6 +81,6 @@ def test_enterprise_hooks_import_failure_logs_warning(monkeypatch, caplog): for record in caplog.records ), "Expected a warning to be logged when enterprise hooks import fails" - monkeypatch.undo() + monkeypatch.setattr(builtins, "__import__", real_import) sys.modules.pop("litellm.proxy.hooks", None) importlib.import_module("litellm.proxy.hooks")