mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
fix(test): add retry logic to flaky e2e_openai_endpoints tests
These tests make external API calls to OpenAI and Anthropic which can be flaky due to: - Transient network issues - API rate limits - Temporary service unavailability Added @pytest.mark.flaky(retries=3, delay=2) decorator to: - test_streaming_response - test_anthropic_with_responses_api - test_cancel_response - test_cancel_streaming_response This matches the existing pattern used by test_basic_response.
This commit is contained in:
parent
0c785b333b
commit
37aec0a1ab
1 changed files with 4 additions and 0 deletions
|
|
@ -91,6 +91,7 @@ def test_basic_response():
|
|||
get_response = client.responses.retrieve(response.id)
|
||||
|
||||
|
||||
@pytest.mark.flaky(retries=3, delay=2)
|
||||
def test_streaming_response():
|
||||
client = get_test_client()
|
||||
stream = client.responses.create(
|
||||
|
|
@ -120,6 +121,7 @@ def test_bad_request_bad_param_error():
|
|||
model="gpt-4o", input="This should fail", temperature=2000
|
||||
)
|
||||
|
||||
@pytest.mark.flaky(retries=3, delay=2)
|
||||
def test_anthropic_with_responses_api():
|
||||
client = get_test_client()
|
||||
response = client.responses.create(
|
||||
|
|
@ -130,6 +132,7 @@ def test_anthropic_with_responses_api():
|
|||
print("anthropic response=", response)
|
||||
|
||||
|
||||
@pytest.mark.flaky(retries=3, delay=2)
|
||||
def test_cancel_response():
|
||||
try:
|
||||
client = get_test_client()
|
||||
|
|
@ -152,6 +155,7 @@ def test_cancel_response():
|
|||
raise e
|
||||
|
||||
|
||||
@pytest.mark.flaky(retries=3, delay=2)
|
||||
def test_cancel_streaming_response():
|
||||
try:
|
||||
client = get_test_client()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue