Skip to content

Commit

Permalink
add 2 more tests for 503 and 408 retries
Browse files Browse the repository at this point in the history
  • Loading branch information
ahartel committed Aug 10, 2022
1 parent ee2e529 commit 7008dfe
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ def httpserver_listen_address():


def test_timeout(httpserver):

def handler(foo):
time.sleep(2)

Expand All @@ -400,3 +399,18 @@ def handler(foo):
host="http://localhost:8000/", token="AA_TOKEN", request_timeout_seconds=0.1
)


def test_retry_on_503(httpserver):
httpserver.expect_request("/version").respond_with_data("busy", status=503)

"""Ensures Timeouts works. AlephAlphaClient constructor calls version endpoint."""
with pytest.raises(requests.exceptions.RetryError):
AlephAlphaClient(host="http://localhost:8000/", token="AA_TOKEN")


def test_retry_on_408(httpserver):
httpserver.expect_request("/version").respond_with_data("busy", status=408)

"""Ensures Timeouts works. AlephAlphaClient constructor calls version endpoint."""
with pytest.raises(requests.exceptions.RetryError):
AlephAlphaClient(host="http://localhost:8000/", token="AA_TOKEN")

0 comments on commit 7008dfe

Please sign in to comment.