Skip to content

Commit

Permalink
add test_040_request_autocalc_retries - 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ric-evans committed Aug 2, 2023
1 parent c72938a commit 97875eb
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/unit_client/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,19 @@ async def test_030_request(requests_mock: Mock) -> None:
@pytest.mark.asyncio
async def test_040_request_autocalc_retries() -> None:
"""Test auto-calculated retries options in `RestClient`."""
rc = RestClient(
"http://test",
"passkey",
timeout=0.1,
retries=10,
backoff_factor=1.0,
)
for timeout, backoff_factor, arg, out in [
(0.5, 0.75, 1, 1),
(0.5, 0.75, CalcRetryFromBackoffMax(8.1), 2), # 2.88042
(0.5, 0.75, CalcRetryFromWaittimeMax(100), 6), # 6.02953
]:
rc = RestClient(
"http://test",
"passkey",
timeout=timeout,
retries=arg,
backoff_factor=backoff_factor,
)
assert rc.retries == out


def test_100_request_seq(requests_mock: Mock) -> None:
Expand Down

0 comments on commit 97875eb

Please sign in to comment.