Skip to content

Commit

Permalink
Make test_reconnect robust to slower runs.
Browse files Browse the repository at this point in the history
This avoids failures with higher WEBSOCKETS_TESTS_TIMEOUT_FACTOR,
notably on PyPy.

Refs #1483.
  • Loading branch information
aaugustin committed Aug 9, 2024
1 parent 84e8bd8 commit a3ed160
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/legacy/test_client_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
import platform
import random
import re
import socket
import ssl
import sys
Expand Down Expand Up @@ -1608,16 +1609,19 @@ async def run_client():
)
# Iteration 3
self.assertEqual(
[record.getMessage() for record in logs.records][4:-1],
[
re.sub(r"[0-9\.]+ seconds", "X seconds", record.getMessage())
for record in logs.records
][4:-1],
[
"connection rejected (503 Service Unavailable)",
"connection closed",
"! connect failed; reconnecting in 0.0 seconds",
"! connect failed; reconnecting in X seconds",
]
+ [
"connection rejected (503 Service Unavailable)",
"connection closed",
"! connect failed again; retrying in 0 seconds",
"! connect failed again; retrying in X seconds",
]
* ((len(logs.records) - 8) // 3)
+ [
Expand Down

0 comments on commit a3ed160

Please sign in to comment.