From 55abf377a88b2dc49b613635b547d5147257a2ac Mon Sep 17 00:00:00 2001 From: richardsheridan Date: Sat, 11 Mar 2023 13:10:36 -0500 Subject: [PATCH 1/2] use autojump_threshold in test_handshake_over_terrible_network observation: any autojump threshold over 0 takes MUCH longer than 0 hypothesis: 10 second timeout cscope at the end of test is spuriously cancelling attempts on slow machines experiment: set a minimal threshold and scale back # of handshakes to finish in a reasonable time, check if CI timeouts are avoided --- trio/tests/test_dtls.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trio/tests/test_dtls.py b/trio/tests/test_dtls.py index e771d8acbe..d8ef2e4078 100644 --- a/trio/tests/test_dtls.py +++ b/trio/tests/test_dtls.py @@ -103,10 +103,12 @@ async def test_smoke(ipv6): @slow async def test_handshake_over_terrible_network(autojump_clock): # PyPy is not fast enough - HANDSHAKES = 500 if sys.implementation.name == "pypy" else 1000 + HANDSHAKES = 50 if sys.implementation.name == "pypy" else 100 r = random.Random(0) fn = FakeNet() fn.enable() + # avoid spurious timeouts on slow machines + autojump_clock.autojump_threshold = 0.001 async with dtls_echo_server() as (_, address): async with trio.open_nursery() as nursery: From 4aace6d2d45cada9fc86706495bcfec9c244eff7 Mon Sep 17 00:00:00 2001 From: richardsheridan Date: Sat, 11 Mar 2023 20:19:17 -0500 Subject: [PATCH 2/2] unify HANDSHAKES on all platforms --- trio/tests/test_dtls.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/trio/tests/test_dtls.py b/trio/tests/test_dtls.py index d8ef2e4078..1420ea43d1 100644 --- a/trio/tests/test_dtls.py +++ b/trio/tests/test_dtls.py @@ -3,7 +3,6 @@ import trio.testing from trio import DTLSEndpoint import random -import sys import attr from contextlib import asynccontextmanager from itertools import count @@ -102,8 +101,7 @@ async def test_smoke(ipv6): @slow async def test_handshake_over_terrible_network(autojump_clock): - # PyPy is not fast enough - HANDSHAKES = 50 if sys.implementation.name == "pypy" else 100 + HANDSHAKES = 100 r = random.Random(0) fn = FakeNet() fn.enable()