diff --git a/tests/test_advanced_streaming.py b/tests/test_advanced_streaming.py index 64f24167..907a2196 100644 --- a/tests/test_advanced_streaming.py +++ b/tests/test_advanced_streaming.py @@ -313,9 +313,8 @@ async def inf_streamer( # `trio.EndOfChannel` doesn't propagate directly to the above # .open_stream() parent, resulting in it also raising instead # of gracefully absorbing as normal.. so how to handle? - trio.open_nursery( - strict_exception_groups=False, - ) as tn, + tractor.trionics.collapse_eg(), + trio.open_nursery() as tn, ): async def close_stream_on_sentinel(): async for msg in stream: diff --git a/tests/test_cancellation.py b/tests/test_cancellation.py index a970c83c..06c6dc8d 100644 --- a/tests/test_cancellation.py +++ b/tests/test_cancellation.py @@ -532,10 +532,15 @@ def test_cancel_via_SIGINT_other_task( async def main(): # should never timeout since SIGINT should cancel the current program with trio.fail_after(timeout): - async with trio.open_nursery( - strict_exception_groups=False, - ) as n: - await n.start(spawn_and_sleep_forever) + async with ( + + # XXX ?TODO? why no work!? + # tractor.trionics.collapse_eg(), + trio.open_nursery( + strict_exception_groups=False, + ) as tn, + ): + await tn.start(spawn_and_sleep_forever) if 'mp' in spawn_backend: time.sleep(0.1) os.kill(pid, signal.SIGINT) diff --git a/tests/test_child_manages_service_nursery.py b/tests/test_child_manages_service_nursery.py index 540e9b2e..6379afc6 100644 --- a/tests/test_child_manages_service_nursery.py +++ b/tests/test_child_manages_service_nursery.py @@ -117,9 +117,10 @@ async def open_actor_local_nursery( ctx: tractor.Context, ): global _nursery - async with trio.open_nursery( - strict_exception_groups=False, - ) as tn: + async with ( + tractor.trionics.collapse_eg(), + trio.open_nursery() as tn + ): _nursery = tn await ctx.started() await trio.sleep(10) diff --git a/tests/test_discovery.py b/tests/test_discovery.py index 65a76d08..453b1aa3 100644 --- a/tests/test_discovery.py +++ b/tests/test_discovery.py @@ -11,6 +11,7 @@ import psutil import pytest import subprocess import tractor +from tractor.trionics import collapse_eg from tractor._testing import tractor_test import trio @@ -193,10 +194,10 @@ async def spawn_and_check_registry( try: async with tractor.open_nursery() as an: - async with trio.open_nursery( - strict_exception_groups=False, - ) as trion: - + async with ( + collapse_eg(), + trio.open_nursery() as trion, + ): portals = {} for i in range(3): name = f'a{i}' @@ -338,11 +339,12 @@ async def close_chans_before_nursery( async with portal2.open_stream_from( stream_forever ) as agen2: - async with trio.open_nursery( - strict_exception_groups=False, - ) as n: - n.start_soon(streamer, agen1) - n.start_soon(cancel, use_signal, .5) + async with ( + collapse_eg(), + trio.open_nursery() as tn, + ): + tn.start_soon(streamer, agen1) + tn.start_soon(cancel, use_signal, .5) try: await streamer(agen2) finally: diff --git a/tests/test_infected_asyncio.py b/tests/test_infected_asyncio.py index 195ed4cd..edd7ee47 100644 --- a/tests/test_infected_asyncio.py +++ b/tests/test_infected_asyncio.py @@ -234,10 +234,8 @@ async def trio_ctx( with trio.fail_after(1 + delay): try: async with ( - trio.open_nursery( - # TODO, for new `trio` / py3.13 - # strict_exception_groups=False, - ) as tn, + tractor.trionics.collapse_eg(), + trio.open_nursery() as tn, tractor.to_asyncio.open_channel_from( sleep_and_err, ) as (first, chan), diff --git a/tests/test_trioisms.py b/tests/test_trioisms.py index c68d75c1..ca1e6d55 100644 --- a/tests/test_trioisms.py +++ b/tests/test_trioisms.py @@ -8,6 +8,7 @@ from contextlib import ( ) import pytest +from tractor.trionics import collapse_eg import trio from trio import TaskStatus @@ -64,9 +65,8 @@ def test_stashed_child_nursery(use_start_soon): async def main(): async with ( - trio.open_nursery( - strict_exception_groups=False, - ) as pn, + collapse_eg(), + trio.open_nursery() as pn, ): cn = await pn.start(mk_child_nursery) assert cn @@ -197,10 +197,8 @@ def test_gatherctxs_with_memchan_breaks_multicancelled( async with ( # XXX should ensure ONLY the KBI # is relayed upward - trionics.collapse_eg(), - trio.open_nursery( - # strict_exception_groups=False, - ), # as tn, + collapse_eg(), + trio.open_nursery(), # as tn, trionics.gather_contexts([ open_memchan(),