Skip to content

Commit a3ed160

Browse files
committed
Make test_reconnect robust to slower runs.
This avoids failures with higher WEBSOCKETS_TESTS_TIMEOUT_FACTOR, notably on PyPy. Refs #1483.
1 parent 84e8bd8 commit a3ed160

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/legacy/test_client_server.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import logging
66
import platform
77
import random
8+
import re
89
import socket
910
import ssl
1011
import sys
@@ -1608,16 +1609,19 @@ async def run_client():
16081609
)
16091610
# Iteration 3
16101611
self.assertEqual(
1611-
[record.getMessage() for record in logs.records][4:-1],
1612+
[
1613+
re.sub(r"[0-9\.]+ seconds", "X seconds", record.getMessage())
1614+
for record in logs.records
1615+
][4:-1],
16121616
[
16131617
"connection rejected (503 Service Unavailable)",
16141618
"connection closed",
1615-
"! connect failed; reconnecting in 0.0 seconds",
1619+
"! connect failed; reconnecting in X seconds",
16161620
]
16171621
+ [
16181622
"connection rejected (503 Service Unavailable)",
16191623
"connection closed",
1620-
"! connect failed again; retrying in 0 seconds",
1624+
"! connect failed again; retrying in X seconds",
16211625
]
16221626
* ((len(logs.records) - 8) // 3)
16231627
+ [

0 commit comments

Comments
 (0)