Skip to content

Commit 97831c6

Browse files
committed
Prevent test_reconnect from looping forever.
If some connection attempts hit open_timeout, this test could go past the 6th iteration, then it continues looping and never exits. Now, it exits more reliably.
1 parent 8ec1d69 commit 97831c6

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎tests/asyncio/test_client.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ async def process_request(connection, request):
193193
elif iterations == 3:
194194
return connection.respond(http.HTTPStatus.SERVICE_UNAVAILABLE, "🚒")
195195
# Fatal error
196-
elif iterations == 6:
196+
elif iterations >= 6:
197197
return connection.respond(http.HTTPStatus.PAYMENT_REQUIRED, "💸")
198198

199199
async with serve(*args, process_request=process_request) as server:

‎tests/sync/test_client.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def process_request(connection, request):
199199
elif iterations == 3:
200200
return connection.respond(http.HTTPStatus.SERVICE_UNAVAILABLE, "🚒")
201201
# Fatal error
202-
elif iterations == 6:
202+
elif iterations >= 6:
203203
return connection.respond(http.HTTPStatus.PAYMENT_REQUIRED, "💸")
204204

205205
with run_server(process_request=process_request) as server:

‎tests/trio/test_client.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ async def process_request(connection, request):
188188
elif iterations == 3:
189189
return connection.respond(http.HTTPStatus.SERVICE_UNAVAILABLE, "🚒")
190190
# Fatal error
191-
elif iterations == 6:
191+
elif iterations >= 6:
192192
return connection.respond(http.HTTPStatus.PAYMENT_REQUIRED, "💸")
193193

194194
async with run_server(process_request=process_request) as server:

0 commit comments

Comments
 (0)