From d6632921386df054723c922b32e20fda085e73c4 Mon Sep 17 00:00:00 2001 From: Yuri Konotopov Date: Fri, 28 Aug 2026 07:54:37 +0000 Subject: [PATCH 4/5] Fixed tests on less common platforms Signed-off-by: Yuri Konotopov Forwarded: https://github.com/mosquito/caio/pull/76 --- tests/test_aio_context.py | 2 +- tests/test_free_threading.py | 2 +- tests/test_raw_low_level.py | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/test_aio_context.py b/tests/test_aio_context.py index 2150852..f1b50e0 100644 --- a/tests/test_aio_context.py +++ b/tests/test_aio_context.py @@ -10,7 +10,7 @@ def test_aio_context(context_maker): ctx = context_maker(1) assert ctx is not None - ctx = context_maker(32218) + ctx = context_maker(128) assert ctx is not None diff --git a/tests/test_free_threading.py b/tests/test_free_threading.py index f50518f..390fd90 100644 --- a/tests/test_free_threading.py +++ b/tests/test_free_threading.py @@ -44,7 +44,7 @@ def test_high_concurrency_stress_no_data_races(tmp_path, submit_and_wait): fd = os.open(str(path), os.O_RDWR | _O_BINARY) ctx = None try: - ctx = python_aio.Context(max_requests=count, pool_size=32) + ctx = python_aio.Context(max_requests=count, pool_size=8) expected = [bytes([i % 256]) * chunk for i in range(count)] writes = ( diff --git a/tests/test_raw_low_level.py b/tests/test_raw_low_level.py index 905e48d..1308121 100644 --- a/tests/test_raw_low_level.py +++ b/tests/test_raw_low_level.py @@ -455,8 +455,8 @@ def test_uring_context_stays_alive_via_operation_while_genuinely_in_flight(tmp_p r_fd, w_fd = os.pipe() try: - fcntl.fcntl(w_fd, F_SETPIPE_SZ, 4096) - os.write(w_fd, b"f" * 4096) # fill the pipe so the next write blocks until drained + pipe_size = fcntl.fcntl(w_fd, F_SETPIPE_SZ, 4096) + os.write(w_fd, b"f" * pipe_size) # fill the pipe so the next write blocks until drained ctx = linux_uring.Context(max_requests=8) ctx_ref = weakref.ref(ctx) @@ -476,7 +476,7 @@ def test_uring_context_stays_alive_via_operation_while_genuinely_in_flight(tmp_p "in flight - op.context should have kept it alive" ) - os.read(r_fd, 8192) # unblocks the pending write + os.read(r_fd, pipe_size) # unblocks the pending write drain(ctx_ref(), 1, timeout=5.0) assert op.get_value() == len(b"pending") @@ -1008,7 +1008,7 @@ def test_process_events_negative_timeout_waits_indefinitely(tmp_path, polling_ba def wait(): result["n"] = ctx.process_events(min_requests=1, timeout=-1) - t = threading.Thread(target=wait) + t = threading.Thread(target=wait, daemon=True) t.start() try: t.join(timeout=0.3) @@ -1058,8 +1058,8 @@ def test_uring_process_events_max_requests_bounds_callbacks_not_just_return_valu pipes = [os.pipe() for _ in range(5)] try: for r_fd, w_fd in pipes: - fcntl.fcntl(w_fd, F_SETPIPE_SZ, 4096) - os.write(w_fd, b"f" * 4096) # fill each pipe so the next write blocks + pipe_size = fcntl.fcntl(w_fd, F_SETPIPE_SZ, 4096) + os.write(w_fd, b"f" * pipe_size) # fill each pipe so the next write blocks ctx = linux_uring.Context(max_requests=16) called = [] @@ -1078,7 +1078,7 @@ def test_uring_process_events_max_requests_bounds_callbacks_not_just_return_valu ) for r_fd, _w_fd in pipes: - os.read(r_fd, 8192) + os.read(r_fd, pipe_size) time.sleep(0.05) # let the kernel actually post the completions first = ctx.process_events(max_requests=1, min_requests=0, timeout=0) @@ -1122,8 +1122,8 @@ def test_uring_process_events_min_requests_ignores_cancel_sentinel(tmp_path): fd = f.fileno() r_fd, w_fd = os.pipe() try: - fcntl.fcntl(w_fd, F_SETPIPE_SZ, 4096) - os.write(w_fd, b"f" * 4096) # fill the pipe so the next write blocks + pipe_size = fcntl.fcntl(w_fd, F_SETPIPE_SZ, 4096) + os.write(w_fd, b"f" * pipe_size) # fill the pipe so the next write blocks ctx = linux_uring.Context(max_requests=16) @@ -1150,7 +1150,7 @@ def test_uring_process_events_min_requests_ignores_cancel_sentinel(tmp_path): def drain_pipe_late(): time.sleep(0.2) drained_before_call_returned.set() - os.read(r_fd, 8192) + os.read(r_fd, pipe_size) t = threading.Thread(target=drain_pipe_late) t.start() -- 2.55.0