async def test_run_task(self): owch = 0 async def nest(x): nonlocal owch owch += x with pytest.raises(RuntimeError): trio_asyncio.run_trio_task(nest, 100) with pytest.raises(RuntimeError): with trio_asyncio.open_loop(): nest(1000) async with trio_asyncio.open_loop(): trio_asyncio.run_trio_task(nest, 1) await trio.sleep(0.05) assert owch == 1
async def call(*args, **kwargs): proc_ = proc if kwargs: proc_ = partial(proc_, **kwargs) trio_asyncio.run_trio_task(proc_, *args)
async def call(*args): trio_asyncio.run_trio_task(proc, *args)