diff --git a/test/asynchronous/test_streaming_protocol.py b/test/asynchronous/test_streaming_protocol.py index f019cf4143..645f57e6bc 100644 --- a/test/asynchronous/test_streaming_protocol.py +++ b/test/asynchronous/test_streaming_protocol.py @@ -199,9 +199,14 @@ def hb_failed(event): "appName": "heartbeatEventAwaitedFlag", }, } + # PYTHON-6002: PyPy's JIT warm-up can delay the heartbeat monitor + # thread past the default timeout on slow/throttled CI runners. + timeout = 30 if "PyPy" in sys.version else 10 async with self.fail_point(fail_heartbeat): await async_wait_until( - lambda: hb_listener.matching(hb_failed), "published failed event" + lambda: hb_listener.matching(hb_failed), + "published failed event", + timeout=timeout, ) # Reconnect. await client.admin.command("ping") diff --git a/test/test_streaming_protocol.py b/test/test_streaming_protocol.py index dddd92d73a..e99a9dd4a4 100644 --- a/test/test_streaming_protocol.py +++ b/test/test_streaming_protocol.py @@ -199,8 +199,15 @@ def hb_failed(event): "appName": "heartbeatEventAwaitedFlag", }, } + # PYTHON-6002: PyPy's JIT warm-up can delay the heartbeat monitor + # thread past the default timeout on slow/throttled CI runners. + timeout = 30 if "PyPy" in sys.version else 10 with self.fail_point(fail_heartbeat): - wait_until(lambda: hb_listener.matching(hb_failed), "published failed event") + wait_until( + lambda: hb_listener.matching(hb_failed), + "published failed event", + timeout=timeout, + ) # Reconnect. client.admin.command("ping")