2020-12-10 18:49:11 +00:00
|
|
|
import asyncio
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
import tractor
|
|
|
|
|
|
|
|
async def sleep_and_err():
|
|
|
|
await asyncio.sleep(0.1)
|
|
|
|
assert 0
|
|
|
|
|
|
|
|
|
2020-12-22 02:08:53 +00:00
|
|
|
async def asyncio_actor():
|
|
|
|
assert tractor.current_actor().is_infected_aio()
|
|
|
|
|
2020-12-10 18:49:11 +00:00
|
|
|
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:
|
2020-12-22 02:08:53 +00:00
|
|
|
await n.run_in_actor(asyncio_actor, infected_asyncio=True)
|
2020-12-10 18:49:11 +00:00
|
|
|
|
|
|
|
with pytest.raises(tractor.RemoteActorError) as excinfo:
|
|
|
|
tractor.run(main, arbiter_addr=arb_addr)
|