mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
fix(test): use patch.object for reliable module attribute patching in cold storage test
The test was using patch('litellm.cold_storage_custom_logger', return_value='s3')
which creates a MagicMock object. While this works in most environments,
it can behave inconsistently in certain CI environments.
Changed to patch.object(litellm, 'cold_storage_custom_logger', 's3') which
directly sets the attribute value and ensures consistent behavior across
all test environments.
Fixes test_should_check_cold_storage_for_full_payload in litellm_mapped_tests_core
This commit is contained in:
parent
df387c39f6
commit
71d77c489b
1 changed files with 3 additions and 1 deletions
|
|
@ -343,7 +343,9 @@ async def test_should_check_cold_storage_for_full_payload():
|
|||
# Test case 4: None request (should return True)
|
||||
proxy_request_none = None
|
||||
|
||||
with patch("litellm.cold_storage_custom_logger", return_value="s3"):
|
||||
# Use patch.object to properly set the attribute value (not a mock)
|
||||
# This ensures consistent behavior across all test environments
|
||||
with patch.object(litellm, 'cold_storage_custom_logger', 's3'):
|
||||
# Test case 1: Should return True for truncated content
|
||||
result1 = ResponsesSessionHandler._should_check_cold_storage_for_full_payload(proxy_request_with_truncated_pdf)
|
||||
assert result1 == True, "Should return True for proxy request with truncated PDF content"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue