mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-05 16:24:59 +00:00
test(local): skip httpbin timeout probe when the service returns 5xx
local_testing_part1 was failing on test_post_delay_exceeds_per_request_timeout_raises because httpbin.org/delay/10 intermittently answers 503 instead of delaying, so HTTPHandler.post raised MaskedHTTPStatusError rather than the expected Timeout. The test already means to skip when httpbin is unavailable, but its guard only probed GET /get and ignored a server error on the delay endpoint. Treat a 5xx from httpbin as 'service unavailable' and skip, which is outside this repo's control, while still asserting Timeout when httpbin genuinely delays.
This commit is contained in:
@@ -18,7 +18,10 @@ import pytest
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
|
||||
|
||||
from litellm.exceptions import Timeout as LitellmTimeout
|
||||
from litellm.llms.custom_httpx.http_handler import _get_httpx_client
|
||||
from litellm.llms.custom_httpx.http_handler import (
|
||||
MaskedHTTPStatusError,
|
||||
_get_httpx_client,
|
||||
)
|
||||
|
||||
_HTTPBIN_DELAY_S = 10
|
||||
_PER_REQUEST_TIMEOUT_S = 5.0
|
||||
@@ -40,5 +43,7 @@ def test_post_delay_exceeds_per_request_timeout_raises():
|
||||
data=json.dumps({"model": "claude", "messages": []}),
|
||||
timeout=_PER_REQUEST_TIMEOUT_S,
|
||||
)
|
||||
except MaskedHTTPStatusError as e:
|
||||
pytest.skip(f"httpbin.org unavailable: {e}")
|
||||
finally:
|
||||
handler.close()
|
||||
|
||||
Reference in New Issue
Block a user