Skip to content

Commit ef73f38

Browse files
committed
add some tests for kqueue
1 parent 31891d1 commit ef73f38

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/trio/_core/_tests/test_io.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,21 @@ def check(
410410
# 1 for call_soon_task
411411
check(expected_monitors=0, expected_readers=1, expected_writers=0)
412412

413-
with _core.monitor_kevent(a1.fileno(), select.KQ_FILTER_READ):
413+
with _core.monitor_kevent(a1.fileno(), select.KQ_FILTER_READ) as q:
414414
with (
415415
pytest.raises(_core.BusyResourceError),
416416
_core.monitor_kevent(a1.fileno(), select.KQ_FILTER_READ),
417417
):
418418
pass # pragma: no cover
419419
check(expected_monitors=1, expected_readers=1, expected_writers=0)
420+
b1.write(b"\x00")
421+
with trio.fail_after(1):
422+
await q.receive()
423+
424+
_core.notify_closing(a1)
425+
a1.close()
426+
with trio.fail_after(1):
427+
assert len([v async for v in q]) == 0
420428

421429
check(expected_monitors=0, expected_readers=1, expected_writers=0)
422430

0 commit comments

Comments
 (0)