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:
shin-bot-litellm 2026-02-01 00:22:30 +00:00
parent 0c785b333b
commit 37aec0a1ab

View file

@ -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()