diff --git a/tests/test_inter_peer_cancellation.py b/tests/test_inter_peer_cancellation.py index 84865824..86863fb1 100644 --- a/tests/test_inter_peer_cancellation.py +++ b/tests/test_inter_peer_cancellation.py @@ -1225,12 +1225,16 @@ def test_peer_spawns_and_cancels_service_subactor( # assert spawn_ctx.cancelled_caught + async def _main(): + with trio.fail_after(2): + await main() + if raise_sub_spawn_error_after: with pytest.raises(RemoteActorError) as excinfo: - trio.run(main) + trio.run(_main) rae: RemoteActorError = excinfo.value check_inner_rte(rae) else: - trio.run(main) + trio.run(_main)