Debian Codegraph @

debian/patches/0004-tests.patch

raw
1 From d6632921386df054723c922b32e20fda085e73c4 Mon Sep 17 00:00:00 2001
2 From: Yuri Konotopov <[email protected]>
3 Date: Fri, 28 Aug 2026 07:54:37 +0000
4 Subject: [PATCH 4/5] Fixed tests on less common platforms
5
6 Signed-off-by: Yuri Konotopov <[email protected]>
7
8 Forwarded: https://github.com/mosquito/caio/pull/76
9 ---
10 tests/test_aio_context.py | 2 +-
11 tests/test_free_threading.py | 2 +-
12 tests/test_raw_low_level.py | 20 ++++++++++----------
13 3 files changed, 12 insertions(+), 12 deletions(-)
14
15 diff --git a/tests/test_aio_context.py b/tests/test_aio_context.py
16 index 2150852..f1b50e0 100644
17 --- a/tests/test_aio_context.py
18 +++ b/tests/test_aio_context.py
19 @@ -10,7 +10,7 @@ def test_aio_context(context_maker):
20 ctx = context_maker(1)
21 assert ctx is not None
22
23 - ctx = context_maker(32218)
24 + ctx = context_maker(128)
25 assert ctx is not None
26
27
28 diff --git a/tests/test_free_threading.py b/tests/test_free_threading.py
29 index f50518f..390fd90 100644
30 --- a/tests/test_free_threading.py
31 +++ b/tests/test_free_threading.py
32 @@ -44,7 +44,7 @@ def test_high_concurrency_stress_no_data_races(tmp_path, submit_and_wait):
33 fd = os.open(str(path), os.O_RDWR | _O_BINARY)
34 ctx = None
35 try:
36 - ctx = python_aio.Context(max_requests=count, pool_size=32)
37 + ctx = python_aio.Context(max_requests=count, pool_size=8)
38 expected = [bytes([i % 256]) * chunk for i in range(count)]
39
40 writes = (
41 diff --git a/tests/test_raw_low_level.py b/tests/test_raw_low_level.py
42 index 905e48d..1308121 100644
43 --- a/tests/test_raw_low_level.py
44 +++ b/tests/test_raw_low_level.py
45 @@ -455,8 +455,8 @@ def test_uring_context_stays_alive_via_operation_while_genuinely_in_flight(tmp_p
46
47 r_fd, w_fd = os.pipe()
48 try:
49 - fcntl.fcntl(w_fd, F_SETPIPE_SZ, 4096)
50 - os.write(w_fd, b"f" * 4096) # fill the pipe so the next write blocks until drained
51 + pipe_size = fcntl.fcntl(w_fd, F_SETPIPE_SZ, 4096)
52 + os.write(w_fd, b"f" * pipe_size) # fill the pipe so the next write blocks until drained
53
54 ctx = linux_uring.Context(max_requests=8)
55 ctx_ref = weakref.ref(ctx)
56 @@ -476,7 +476,7 @@ def test_uring_context_stays_alive_via_operation_while_genuinely_in_flight(tmp_p
57 "in flight - op.context should have kept it alive"
58 )
59
60 - os.read(r_fd, 8192) # unblocks the pending write
61 + os.read(r_fd, pipe_size) # unblocks the pending write
62 drain(ctx_ref(), 1, timeout=5.0)
63 assert op.get_value() == len(b"pending")
64
65 @@ -1008,7 +1008,7 @@ def test_process_events_negative_timeout_waits_indefinitely(tmp_path, polling_ba
66 def wait():
67 result["n"] = ctx.process_events(min_requests=1, timeout=-1)
68
69 - t = threading.Thread(target=wait)
70 + t = threading.Thread(target=wait, daemon=True)
71 t.start()
72 try:
73 t.join(timeout=0.3)
74 @@ -1058,8 +1058,8 @@ def test_uring_process_events_max_requests_bounds_callbacks_not_just_return_valu
75 pipes = [os.pipe() for _ in range(5)]
76 try:
77 for r_fd, w_fd in pipes:
78 - fcntl.fcntl(w_fd, F_SETPIPE_SZ, 4096)
79 - os.write(w_fd, b"f" * 4096) # fill each pipe so the next write blocks
80 + pipe_size = fcntl.fcntl(w_fd, F_SETPIPE_SZ, 4096)
81 + os.write(w_fd, b"f" * pipe_size) # fill each pipe so the next write blocks
82
83 ctx = linux_uring.Context(max_requests=16)
84 called = []
85 @@ -1078,7 +1078,7 @@ def test_uring_process_events_max_requests_bounds_callbacks_not_just_return_valu
86 )
87
88 for r_fd, _w_fd in pipes:
89 - os.read(r_fd, 8192)
90 + os.read(r_fd, pipe_size)
91 time.sleep(0.05) # let the kernel actually post the completions
92
93 first = ctx.process_events(max_requests=1, min_requests=0, timeout=0)
94 @@ -1122,8 +1122,8 @@ def test_uring_process_events_min_requests_ignores_cancel_sentinel(tmp_path):
95 fd = f.fileno()
96 r_fd, w_fd = os.pipe()
97 try:
98 - fcntl.fcntl(w_fd, F_SETPIPE_SZ, 4096)
99 - os.write(w_fd, b"f" * 4096) # fill the pipe so the next write blocks
100 + pipe_size = fcntl.fcntl(w_fd, F_SETPIPE_SZ, 4096)
101 + os.write(w_fd, b"f" * pipe_size) # fill the pipe so the next write blocks
102
103 ctx = linux_uring.Context(max_requests=16)
104
105 @@ -1150,7 +1150,7 @@ def test_uring_process_events_min_requests_ignores_cancel_sentinel(tmp_path):
106 def drain_pipe_late():
107 time.sleep(0.2)
108 drained_before_call_returned.set()
109 - os.read(r_fd, 8192)
110 + os.read(r_fd, pipe_size)
111
112 t = threading.Thread(target=drain_pipe_late)
113 t.start()
114 --
115 2.55.0
116