Skip to content

Commit 7f69266

Browse files
committed
Fix CI issues on 3.13 and new Trio
1 parent 8d6744b commit 7f69266

4 files changed

Lines changed: 31 additions & 10 deletions

File tree

‎tests/conftest.py‎

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ def skip(rel_id):
140140
# hangs on 3.11+, fails without hanging on 3.8-3.10
141141
skip("test_windows_events.py::ProactorLoopCtrlC::test_ctrl_c")
142142

143+
if sys.platform == "darwin":
144+
# Times out on GitHub Actions, unclear why
145+
skip("test_events.py::KqueueEventLoopTests::test_create_connection")
146+
143147
if sys.implementation.name == "pypy":
144148
# This test depends on the C implementation of asyncio.Future, and
145149
# unlike most such tests it is not configured to be skipped if
@@ -199,12 +203,29 @@ def skip(rel_id):
199203
xfail(
200204
"test_futures2.py::PyFutureTests::test_task_exc_handler_correct_context"
201205
)
202-
xfail(
203-
"test_futures2.py::CFutureTests::test_task_exc_handler_correct_context"
204-
)
206+
if sys.version_info < (3, 13):
207+
xfail(
208+
"test_futures2.py::CFutureTests::test_task_exc_handler_correct_context"
209+
)
205210

206211
# This test assumes that get_event_loop_policy().get_event_loop() doesn't
207212
# automatically return the running loop
208213
skip(
209214
"test_subprocess.py::GenericWatcherTests::test_create_subprocess_with_pidfd"
210215
)
216+
217+
if sys.version_info >= (3, 13):
218+
if sys.platform == "win32":
219+
for which in ("read", "write", "read_write"):
220+
# These use a facility of the ProactorEventLoop that
221+
# trio-asyncio doesn't support
222+
xfail(
223+
"test_subprocess.py::SubprocessProactorTests::"
224+
f"test_subprocess_{which}_pipe_cancelled"
225+
)
226+
if sys.platform == "darwin":
227+
# Unclear issue
228+
xfail(
229+
"test_tasks.py::RunCoroutineThreadsafeTests::"
230+
"test_run_coroutine_threadsafe_and_cancel"
231+
)

‎tests/interop/test_calls.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ async def cancel_trio(seen):
299299
seen.flag |= 8
300300

301301
seen = Seen()
302-
with trio.testing.RaisesGroup(asyncio.CancelledError):
302+
with pytest.RaisesGroup(asyncio.CancelledError):
303303
await cancel_trio(seen)
304304
assert seen.flag == 1 | 8
305305

‎tests/test_misc.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ async def run_asyncio_loop(nursery, *, task_status=trio.TASK_STATUS_IGNORED):
225225
import signal
226226
import threading
227227

228-
with trio.testing.RaisesGroup(KeyboardInterrupt):
228+
with pytest.RaisesGroup(KeyboardInterrupt):
229229
async with trio.open_nursery() as nursery:
230230
await nursery.start(run_asyncio_loop, nursery)
231231
# Trigger KeyboardInterrupt that should propagate accross the coroutines
@@ -270,7 +270,7 @@ async def trio_task():
270270
scope.cancel()
271271
assert fut.done()
272272
if throw_another:
273-
with trio.testing.RaisesGroup(trio.testing.Matcher(ValueError, match="hi")):
273+
with pytest.RaisesGroup(pytest.RaisesExc(ValueError, match="hi")):
274274
fut.result()
275275
else:
276276
assert fut.cancelled()
@@ -333,9 +333,9 @@ def collect_exceptions(loop, context):
333333
)
334334
expected = [ValueError("hi"), ValueError("lo"), KeyError(), IndexError()]
335335
await raise_in_aio_loop(expected[0])
336-
with trio.testing.RaisesGroup(SystemExit, flatten_subgroups=True):
336+
with pytest.RaisesGroup(SystemExit, flatten_subgroups=True):
337337
await raise_in_aio_loop(SystemExit(0))
338-
with trio.testing.RaisesGroup(SystemExit, flatten_subgroups=True) as result:
338+
with pytest.RaisesGroup(SystemExit, flatten_subgroups=True) as result:
339339
await raise_in_aio_loop(BaseExceptionGroup("", [expected[1], SystemExit()]))
340340

341341
assert len(result.value.exceptions) == 1

‎tests/test_trio_asyncio.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ async def test_cancel_loop_with_tasks(autojump_clock, shield, body_raises):
123123
record = []
124124

125125
if body_raises:
126-
catcher = trio.testing.RaisesGroup(
127-
trio.testing.Matcher(ValueError, match="hi"), flatten_subgroups=True
126+
catcher = pytest.RaisesGroup(
127+
pytest.RaisesExc(ValueError, match="hi"), flatten_subgroups=True
128128
)
129129
else:
130130
catcher = contextlib.nullcontext()

0 commit comments

Comments
 (0)