Add timeout around `trio`-callee-task

debug_lock_blocking
Tyler Goodlet 2022-10-11 13:35:55 -04:00
parent 1c480e6c92
commit 3398153c52
1 changed files with 16 additions and 15 deletions

View File

@ -203,24 +203,25 @@ def test_context_spawns_aio_task_that_errors(
''' '''
async def main(): async def main():
async with tractor.open_nursery() as n: with trio.fail_after(2):
p = await n.start_actor( async with tractor.open_nursery() as n:
'aio_daemon', p = await n.start_actor(
enable_modules=[__name__], 'aio_daemon',
infect_asyncio=True, enable_modules=[__name__],
# debug_mode=True, infect_asyncio=True,
loglevel='cancel', # debug_mode=True,
) loglevel='cancel',
async with p.open_context( )
trio_ctx, async with p.open_context(
) as (ctx, first): trio_ctx,
) as (ctx, first):
assert first == 'start' assert first == 'start'
if parent_cancels: if parent_cancels:
await p.cancel_actor() await p.cancel_actor()
await trio.sleep_forever() await trio.sleep_forever()
with pytest.raises(RemoteActorError) as excinfo: with pytest.raises(RemoteActorError) as excinfo:
trio.run(main) trio.run(main)