Skip to content

Commit 4df83b4

Browse files
authored
Merge pull request #3215 from A5rocks/faster-local-pytest
Sprinkle `@slow` on slow tests
2 parents c36147d + 144ff95 commit 4df83b4

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/trio/_tests/test_highlevel_open_tcp_listeners.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from trio.testing import open_stream_to_socket_listener
2121

2222
from .. import socket as tsocket
23-
from .._core._tests.tutil import binds_ipv6
23+
from .._core._tests.tutil import binds_ipv6, slow
2424

2525
if sys.version_info < (3, 11):
2626
from exceptiongroup import BaseExceptionGroup
@@ -74,6 +74,7 @@ async def test_open_tcp_listeners_specific_port_specific_host() -> None:
7474

7575

7676
@binds_ipv6
77+
@slow
7778
async def test_open_tcp_listeners_ipv6_v6only() -> None:
7879
# Check IPV6_V6ONLY is working properly
7980
(ipv6_listener,) = await open_tcp_listeners(0, host="::1")
@@ -84,6 +85,8 @@ async def test_open_tcp_listeners_ipv6_v6only() -> None:
8485
OSError,
8586
match=r"(Error|all attempts to) connect(ing)* to (\(')*127\.0\.0\.1(', |:)\d+(\): Connection refused| failed)$",
8687
):
88+
# Windows retries failed connections so this takes seconds
89+
# (and that's why this is marked @slow)
8790
await open_tcp_stream("127.0.0.1", port)
8891

8992

src/trio/_tests/test_socket.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import pytest
1515

1616
from .. import _core, socket as tsocket
17-
from .._core._tests.tutil import binds_ipv6, can_create_ipv6, creates_ipv6
17+
from .._core._tests.tutil import binds_ipv6, can_create_ipv6, creates_ipv6, slow
1818
from .._socket import _NUMERIC_ONLY, AddressFormat, SocketType, _SocketType, _try_sync
1919
from ..testing import assert_checkpoints, wait_all_tasks_blocked
2020

@@ -829,6 +829,7 @@ async def t2() -> None:
829829

830830

831831
# This tests the complicated paths through connect
832+
@slow
832833
async def test_SocketType_connect_paths() -> None:
833834
with tsocket.socket() as sock:
834835
with pytest.raises(
@@ -895,17 +896,23 @@ def connect(
895896
# connect to fail. Really. Also if you use a non-routable
896897
# address. This way fails instantly though. As long as nothing
897898
# is listening on port 2.)
899+
900+
# Windows retries failed connections so this takes seconds
901+
# (and that's why this is marked @slow)
898902
await sock.connect(("127.0.0.1", 2))
899903

900904

901905
# Fix issue #1810
906+
@slow
902907
async def test_address_in_socket_error() -> None:
903908
address = "127.0.0.1"
904909
with tsocket.socket() as sock:
905910
with pytest.raises(
906911
OSError,
907912
match=rf"^\[\w+ \d+\] Error connecting to \({address!r}, 2\): (Connection refused|Unknown error)$",
908913
):
914+
# Windows retries failed connections so this takes seconds
915+
# (and that's why this is marked @slow)
909916
await sock.connect((address, 2))
910917

911918

@@ -1215,7 +1222,7 @@ async def receiver() -> None:
12151222

12161223

12171224
async def test_many_sockets() -> None:
1218-
total = 5000 # Must be more than MAX_AFD_GROUP_SIZE
1225+
total = 1000 # Must be more than MAX_AFD_GROUP_SIZE
12191226
sockets = []
12201227
# Open at most <total> socket pairs
12211228
for opened in range(0, total, 2):

src/trio/_tests/tools/test_gen_exports.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
run_ruff,
2424
)
2525

26+
from ..._core._tests.tutil import slow
27+
2628
SOURCE = '''from _run import _public
2729
from collections import Counter
2830
@@ -89,6 +91,7 @@ def test_create_pass_through_args() -> None:
8991
)
9092

9193

94+
@slow
9295
@skip_lints
9396
@pytest.mark.parametrize("imports", [IMPORT_1, IMPORT_2, IMPORT_3])
9497
def test_process(

0 commit comments

Comments
 (0)