mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-21 00:24:55 +00:00
Fix flaky test_caching_with_ttl by using distinct mock responses
The test asserts that a ttl=0 cached entry expires immediately, so the second call should not return cached content. Both calls used the same mock_response text, making the content != assertion always fail. Use different mock_response values so a cache hit is distinguishable. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
a95cae6b1e
commit
670f8a1dd1
@@ -200,9 +200,9 @@ def test_caching_with_ttl():
|
||||
litellm.set_verbose = True
|
||||
litellm.cache = Cache()
|
||||
response1 = completion(
|
||||
model="gpt-3.5-turbo", messages=messages, caching=True, ttl=0, mock_response="Hello world from cache test"
|
||||
model="gpt-3.5-turbo", messages=messages, caching=True, ttl=0, mock_response="Hello world from cache test 1"
|
||||
)
|
||||
response2 = completion(model="gpt-3.5-turbo", messages=messages, caching=True, mock_response="Hello world from cache test")
|
||||
response2 = completion(model="gpt-3.5-turbo", messages=messages, caching=True, mock_response="Hello world from cache test 2")
|
||||
print(f"response1: {response1}")
|
||||
print(f"response2: {response2}")
|
||||
litellm.cache = None # disable cache
|
||||
|
||||
Reference in New Issue
Block a user