Skip to content

Commit

Permalink
Fix flaky retries test (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
florimondmanca authored Nov 8, 2020
1 parent 3ed845c commit db81ed0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/async_tests/test_retries.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async def test_retries_enabled(server: Server) -> None:
backend.push(httpcore.ConnectError(), None)
response = await http.arequest(method, url, headers)
assert backend.pop_open_tcp_stream_intervals() == [
pytest.approx(0, abs=1e-3), # Retry immediately.
pytest.approx(0, abs=5e-3), # Retry immediately.
]
status_code, _, stream, _ = response
assert status_code == 200
Expand All @@ -107,7 +107,7 @@ async def test_retries_enabled(server: Server) -> None:
)
response = await http.arequest(method, url, headers)
assert backend.pop_open_tcp_stream_intervals() == [
pytest.approx(0, abs=1e-3), # Retry immediately.
pytest.approx(0, abs=5e-3), # Retry immediately.
pytest.approx(0.5, rel=0.1), # First backoff.
pytest.approx(1.0, rel=0.1), # Second (increased) backoff.
]
Expand Down
4 changes: 2 additions & 2 deletions tests/sync_tests/test_retries.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_retries_enabled(server: Server) -> None:
backend.push(httpcore.ConnectError(), None)
response = http.request(method, url, headers)
assert backend.pop_open_tcp_stream_intervals() == [
pytest.approx(0, abs=1e-3), # Retry immediately.
pytest.approx(0, abs=5e-3), # Retry immediately.
]
status_code, _, stream, _ = response
assert status_code == 200
Expand All @@ -107,7 +107,7 @@ def test_retries_enabled(server: Server) -> None:
)
response = http.request(method, url, headers)
assert backend.pop_open_tcp_stream_intervals() == [
pytest.approx(0, abs=1e-3), # Retry immediately.
pytest.approx(0, abs=5e-3), # Retry immediately.
pytest.approx(0.5, rel=0.1), # First backoff.
pytest.approx(1.0, rel=0.1), # Second (increased) backoff.
]
Expand Down

0 comments on commit db81ed0

Please sign in to comment.