From 95ad3930422aa2980e4714717a102b4b7e08962e Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 10 Dec 2020 13:49:11 -0500 Subject: [PATCH] Add initial infected asyncio error propagation test --- tests/test_infected_asyncio.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/test_infected_asyncio.py diff --git a/tests/test_infected_asyncio.py b/tests/test_infected_asyncio.py new file mode 100644 index 0000000..6d5b864 --- /dev/null +++ b/tests/test_infected_asyncio.py @@ -0,0 +1,22 @@ +import asyncio + +import pytest +import tractor + +async def sleep_and_err(): + await asyncio.sleep(0.1) + assert 0 + + +async def trio_main(): + await tractor.to_asyncio.run_task(sleep_and_err) + + +def test_infected_simple_error(arb_addr): + + async def main(): + async with tractor.open_nursery() as n: + await n.run_in_actor('asyncio_actor', trio_main, infected_asyncio=True) + + with pytest.raises(tractor.RemoteActorError) as excinfo: + tractor.run(main, arbiter_addr=arb_addr)