tractor/tests/_test.py

23 lines
540 B
Python

import tractor
from tractor.log import get_console_log
log = get_console_log('trace')
def cellar_door():
return "Dang that's beautiful"
async def test_most_beautiful_word():
"""The main ``tractor`` routine.
"""
async with tractor.open_nursery() as n:
portal = await n.run_in_actor('some_linguist', cellar_door)
# The ``async with`` will unblock here since the 'some_linguist'
# actor has completed its main task ``cellar_door``.
print(await portal.result())
tractor.run(test_most_beautiful_word)