Plan asyncio test set

infect_asyncio
Tyler Goodlet 2021-11-05 10:42:43 -04:00
parent 41eddffc2c
commit 299e4192b0
2 changed files with 41 additions and 3 deletions

View File

@ -1,6 +1,7 @@
""" '''
Let's make sure them docs work yah? Let's make sure them docs work yah?
"""
'''
from contextlib import contextmanager from contextlib import contextmanager
import itertools import itertools
import os import os

View File

@ -1,8 +1,13 @@
'''
The most hipster way to force SC onto the stdlib's "async".
'''
import asyncio import asyncio
import pytest import pytest
import tractor import tractor
async def sleep_and_err(): async def sleep_and_err():
await asyncio.sleep(0.1) await asyncio.sleep(0.1)
assert 0 assert 0
@ -14,7 +19,7 @@ async def asyncio_actor():
await tractor.to_asyncio.run_task(sleep_and_err) await tractor.to_asyncio.run_task(sleep_and_err)
def test_infected_simple_error(arb_addr): def test_aio_simple_error(arb_addr):
async def main(): async def main():
async with tractor.open_nursery() as n: async with tractor.open_nursery() as n:
@ -22,3 +27,35 @@ def test_infected_simple_error(arb_addr):
with pytest.raises(tractor.RemoteActorError) as excinfo: with pytest.raises(tractor.RemoteActorError) as excinfo:
tractor.run(main, arbiter_addr=arb_addr) tractor.run(main, arbiter_addr=arb_addr)
def test_aio_cancel_from_trio(arb_addr):
...
def test_aio_cancelled_from_aio_causes_trio_cancelled(arb_addr):
...
def test_trio_cancels_aio(arb_addr):
...
def test_trio_error_cancels_aio(arb_addr):
...
def test_basic_interloop_channel_stream(arb_addr):
...
def test_basic_interloop_channel_stream(arb_addr):
...
def test_trio_cancels_and_channel_exits(arb_addr):
...
def test_aio_errors_and_channel_propagates(arb_addr):
...