Skip `test_ringbuf` at collection off-linux

`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
Gud Boi 2026-06-29 23:33:36 -04:00
parent d9532d1270
commit f22bfdd282
2 changed files with 19 additions and 2 deletions

View File

@ -189,11 +189,16 @@ def test_dynamic_pub_sub(
# sits forever until external SIGINT. The `afk_alarm_w_trace` # sits forever until external SIGINT. The `afk_alarm_w_trace`
# outer guard below is the AFK-safety counterpart (SIGALRM # outer guard below is the AFK-safety counterpart (SIGALRM
# raises in the main thread regardless of trio scope state). # 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 8
if is_forking_spawner if is_forking_spawner
else 20 else 20
) ) * cpu_scaling_factor()
async def main(): async def main():
# bug-class-3 breadcrumb: tag each level of the cancel path # bug-class-3 breadcrumb: tag each level of the cancel path

View File

@ -1,10 +1,22 @@
import time import time
import platform
import trio import trio
import pytest import pytest
import tractor 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.. # XXX `cffi` dun build on py3.14 yet..
pytest.importorskip("cffi") pytest.importorskip("cffi")