From f22bfdd2824cfa045310af71266d2f47ac1eb1f2 Mon Sep 17 00:00:00 2001 From: goodboy Date: Mon, 29 Jun 2026 23:33:36 -0400 Subject: [PATCH] Skip `test_ringbuf` at collection off-linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `tests/test_ringbuf.py` imports `tractor.ipc._ringbuf` at module top, which pulls in `tractor.ipc._linux` whose module-level `ffi.dlopen(None)` raises `OSError` on Windows (and any non-linux host). That fires at COLLECTION, before the module's existing `pytestmark = pytest.mark.skip` can apply, so it aborts the whole pytest session — the new `windows-latest` CI leg never gets past collection. - guard the module with `pytest.skip(allow_module_level=True)` gated on `platform.system() != 'Linux'`, placed before the crashing import — same idiom as `tests/devx/test_debugger.py`. - the `eventfd`-based ringbuf backend is linux-only by design, so macOS skips cleanly too (previously it only skipped incidentally via the absent `cffi` optional dep). (this patch was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code --- tests/test_advanced_streaming.py | 9 +++++++-- tests/test_ringbuf.py | 12 ++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/test_advanced_streaming.py b/tests/test_advanced_streaming.py index c04bf130..826634af 100644 --- a/tests/test_advanced_streaming.py +++ b/tests/test_advanced_streaming.py @@ -189,11 +189,16 @@ def test_dynamic_pub_sub( # sits forever until external SIGINT. The `afk_alarm_w_trace` # outer guard below is the AFK-safety counterpart (SIGALRM # raises in the main thread regardless of trio scope state). - fail_after_s: int = ( + # scale the budget for slow/noisy CI runners (esp. macOS, where + # `cpu_scaling_factor()` applies a 3x CI bump) so a sluggish + # runner doesn't trip the deadline and inject a `TooSlowError` + # that collides with the `expect_cancel_exc=TooSlowError` param. + from .conftest import cpu_scaling_factor + fail_after_s: float = ( 8 if is_forking_spawner else 20 - ) + ) * cpu_scaling_factor() async def main(): # bug-class-3 breadcrumb: tag each level of the cancel path diff --git a/tests/test_ringbuf.py b/tests/test_ringbuf.py index e55a87b9..2c739568 100644 --- a/tests/test_ringbuf.py +++ b/tests/test_ringbuf.py @@ -1,10 +1,22 @@ import time +import platform import trio import pytest import tractor +# `tractor.ipc._ringbuf` is built on linux `eventfd(2)`; importing +# it pulls in `tractor.ipc._linux` whose module-level +# `ffi.dlopen(None)` raises on non-linux. Skip the whole module at +# COLLECTION before that crashing import runs (a `pytestmark` skip +# is too late — markers apply only after the import succeeds). +if platform.system() != 'Linux': + pytest.skip( + 'ringbuf (eventfd) IPC is linux-only', + allow_module_level=True, + ) + # XXX `cffi` dun build on py3.14 yet.. pytest.importorskip("cffi")