From f1c710a608d44dafc112d43f676be069d239302e Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Sat, 23 Aug 2025 13:33:33 -0700 Subject: [PATCH] test_e2e_generate_cold_storage_object_key_not_configured --- .../test_litellm_logging.py | 40 ++++--------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/tests/test_litellm/litellm_core_utils/test_litellm_logging.py b/tests/test_litellm/litellm_core_utils/test_litellm_logging.py index 8fd73dbb79..48a22dcc8a 100644 --- a/tests/test_litellm/litellm_core_utils/test_litellm_logging.py +++ b/tests/test_litellm/litellm_core_utils/test_litellm_logging.py @@ -446,48 +446,24 @@ async def test_e2e_generate_cold_storage_object_key_not_configured(): from datetime import datetime, timezone from unittest.mock import patch + import litellm from litellm.litellm_core_utils.litellm_logging import StandardLoggingPayloadSetup # Create test data start_time = datetime(2025, 1, 15, 10, 30, 45, 123456, timezone.utc) response_id = "chatcmpl-test-67890" team_alias = "another-team" - - with patch("litellm.configured_cold_storage_logger", return_value=None): - + + # Use patch to ensure test isolation + with patch.object(litellm, 'configured_cold_storage_logger', None): # Call the function result = StandardLoggingPayloadSetup._generate_cold_storage_object_key( start_time=start_time, response_id=response_id, team_alias=team_alias ) - - # Verify the result is None when cold storage is not configured - assert result is None - - -@pytest.mark.asyncio -async def test_e2e_generate_cold_storage_object_key_runtime_error_handled(): - """Ensure runtime errors while loading cold storage logger are ignored.""" - from datetime import datetime, timezone - from unittest.mock import patch - - from litellm.litellm_core_utils.litellm_logging import StandardLoggingPayloadSetup - - start_time = datetime(2025, 1, 15, 10, 30, 45, 123456, timezone.utc) - response_id = "chatcmpl-test-runtime" - team_alias = "team" - - with patch( - "litellm.configured_cold_storage_logger", - side_effect=RuntimeError("can't register atexit after shutdown"), - ): - result = StandardLoggingPayloadSetup._generate_cold_storage_object_key( - start_time=start_time, - response_id=response_id, - team_alias=team_alias, - ) - - # When an exception occurs retrieving the cold storage logger, the - # function should return None instead of raising. + + # Verify the result is None when cold storage is not configured assert result is None + +