Compare commits
No commits in common. "cf56f33be6586df191270a217c64e156b04e5b1b" and "1d59f1963c61013e412e9a46c8754f8fef9078cf" have entirely different histories.
cf56f33be6
...
1d59f1963c
|
|
@ -1,5 +0,0 @@
|
|||
Remove legacy ``ActorNursery.run_in_actor()``,
|
||||
``Portal.wait_for_result()`` and ``Portal.result()``. Use
|
||||
``tractor.to_actor.run()`` for caller-owned one-shot tasks,
|
||||
``Portal.run()`` for daemon RPC results or ``Portal.open_context()``
|
||||
for linked task dialogs.
|
||||
|
|
@ -94,18 +94,6 @@ async def sleep_forever():
|
|||
await trio.sleep_forever()
|
||||
|
||||
|
||||
@tractor.context
|
||||
async def sleep_forever_ctx(
|
||||
ctx: tractor.Context,
|
||||
) -> None:
|
||||
'''
|
||||
Signal task startup before sleeping until context cancellation.
|
||||
|
||||
'''
|
||||
await ctx.started()
|
||||
await sleep_forever()
|
||||
|
||||
|
||||
async def do_nuthin():
|
||||
# just nick the scheduler
|
||||
await trio.sleep(0)
|
||||
|
|
@ -216,39 +204,9 @@ def test_multierror(
|
|||
with pytest.raises((
|
||||
BaseExceptionGroup,
|
||||
tractor.RemoteActorError,
|
||||
)) as excinfo:
|
||||
)):
|
||||
trio.run(main)
|
||||
|
||||
exc = excinfo.value
|
||||
if isinstance(exc, tractor.RemoteActorError):
|
||||
assert exc.boxed_type is AssertionError
|
||||
return
|
||||
|
||||
def iter_group_leaves(
|
||||
group: BaseExceptionGroup,
|
||||
):
|
||||
for subexc in group.exceptions:
|
||||
if isinstance(subexc, BaseExceptionGroup):
|
||||
yield from iter_group_leaves(subexc)
|
||||
else:
|
||||
yield subexc
|
||||
|
||||
assertion_errors: list[tractor.RemoteActorError] = []
|
||||
cancellations: list[BaseException] = []
|
||||
for leaf in iter_group_leaves(exc):
|
||||
if isinstance(leaf, tractor.ContextCancelled):
|
||||
cancellations.append(leaf)
|
||||
elif isinstance(leaf, trio.Cancelled):
|
||||
cancellations.append(leaf)
|
||||
else:
|
||||
assert isinstance(leaf, tractor.RemoteActorError)
|
||||
assert leaf.boxed_type is AssertionError
|
||||
assertion_errors.append(leaf)
|
||||
|
||||
assert len(assertion_errors) in (1, 2)
|
||||
if not cancellations:
|
||||
assert len(assertion_errors) == 2
|
||||
|
||||
|
||||
async def do_nothing():
|
||||
pass
|
||||
|
|
@ -436,7 +394,7 @@ async def test_some_cancels_all(
|
|||
|
||||
except tractor.RemoteActorError as err:
|
||||
assert err.boxed_type == err_type
|
||||
# we only expect this first error to propagate
|
||||
# we only expect this first error to propogate
|
||||
# (all other daemons are cancelled before they
|
||||
# can be scheduled)
|
||||
num_actors = 1
|
||||
|
|
@ -445,7 +403,7 @@ async def test_some_cancels_all(
|
|||
else:
|
||||
if expect_error:
|
||||
pytest.fail(
|
||||
"Daemon call should fail at checkpoint?")
|
||||
"Deamon call should fail at checkpoint?")
|
||||
|
||||
# should error here with a `RemoteActorError` or a beg of them
|
||||
|
||||
|
|
@ -869,23 +827,13 @@ def test_cancel_via_SIGINT_other_task(
|
|||
async with tractor.open_nursery(
|
||||
registry_addrs=[reg_addr],
|
||||
) as an:
|
||||
portals = [
|
||||
# just keep a set of (daemon) subactors alive for the
|
||||
# SIGINT to cancel (was 3 `run_in_actor(sleep_forever)`
|
||||
# one-shots — a daemon needs no "main" task to idle).
|
||||
for i in range(3):
|
||||
await an.start_actor(
|
||||
f'namesucka_{i}',
|
||||
enable_modules=[__name__],
|
||||
)
|
||||
for i in range(3)
|
||||
]
|
||||
|
||||
# Keep one linked RPC task active in every daemon before
|
||||
# reporting startup, preserving the original
|
||||
# `run_in_actor(sleep_forever)` cancellation target.
|
||||
async with gather_contexts(
|
||||
mngrs=[
|
||||
portal.open_context(sleep_forever_ctx)
|
||||
for portal in portals
|
||||
],
|
||||
):
|
||||
task_status.started()
|
||||
await trio.sleep_forever()
|
||||
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@ def test_basic_interloop_channel_stream(
|
|||
async with tractor.open_nursery(
|
||||
registry_addrs=[reg_addr],
|
||||
) as an:
|
||||
# should raise RAE directly
|
||||
# should raise RAE diectly
|
||||
await to_actor.run(
|
||||
partial(
|
||||
stream_from_aio,
|
||||
|
|
@ -726,7 +726,7 @@ def test_trio_closes_early_causes_aio_checkpoint_raise(
|
|||
# enable_stack_on_sig=True,
|
||||
registry_addrs=[reg_addr],
|
||||
) as an:
|
||||
# should raise RAE directly
|
||||
# should raise RAE diectly
|
||||
print('waiting on final infected subactor result..')
|
||||
res: None = await to_actor.run(
|
||||
partial(
|
||||
|
|
@ -779,7 +779,7 @@ def test_aio_exits_early_relays_AsyncioTaskExited(
|
|||
debug_mode=debug_mode,
|
||||
# enable_stack_on_sig=True,
|
||||
) as an:
|
||||
# should raise RAE directly
|
||||
# should raise RAE diectly
|
||||
print('waiting on final infected subactor result..')
|
||||
res: None = await to_actor.run(
|
||||
partial(
|
||||
|
|
|
|||
Loading…
Reference in New Issue