forked from goodboy/tractor
Mostly drop run from local tests
parent
1584c547cd
commit
cb527c2562
|
@ -15,8 +15,8 @@ async def test_no_arbitter():
|
||||||
"""An arbitter must be established before any nurseries
|
"""An arbitter must be established before any nurseries
|
||||||
can be created.
|
can be created.
|
||||||
|
|
||||||
(In other words ``tractor.run`` must be used instead of ``trio.run`` as is
|
(In other words ``tractor.open_root_actor()`` must be engaged at
|
||||||
done by the ``pytest-trio`` plugin.)
|
some point?)
|
||||||
"""
|
"""
|
||||||
with pytest.raises(RuntimeError):
|
with pytest.raises(RuntimeError):
|
||||||
with tractor.open_nursery():
|
with tractor.open_nursery():
|
||||||
|
@ -49,7 +49,8 @@ async def test_self_is_registered_localportal(arb_addr):
|
||||||
assert isinstance(portal, tractor._portal.LocalPortal)
|
assert isinstance(portal, tractor._portal.LocalPortal)
|
||||||
|
|
||||||
with trio.fail_after(0.2):
|
with trio.fail_after(0.2):
|
||||||
sockaddr = await portal.run_from_ns('self', 'wait_for_actor', name='root')
|
sockaddr = await portal.run_from_ns(
|
||||||
|
'self', 'wait_for_actor', name='root')
|
||||||
assert sockaddr[0] == arb_addr
|
assert sockaddr[0] == arb_addr
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,6 +60,10 @@ def test_local_actor_async_func(arb_addr):
|
||||||
nums = []
|
nums = []
|
||||||
|
|
||||||
async def print_loop():
|
async def print_loop():
|
||||||
|
|
||||||
|
async with tractor.open_root_actor(
|
||||||
|
arbiter_addr=arb_addr,
|
||||||
|
):
|
||||||
# arbiter is started in-proc if dne
|
# arbiter is started in-proc if dne
|
||||||
assert tractor.current_actor().is_arbiter
|
assert tractor.current_actor().is_arbiter
|
||||||
|
|
||||||
|
@ -67,7 +72,7 @@ def test_local_actor_async_func(arb_addr):
|
||||||
await trio.sleep(0.1)
|
await trio.sleep(0.1)
|
||||||
|
|
||||||
start = time.time()
|
start = time.time()
|
||||||
tractor.run(print_loop, arbiter_addr=arb_addr)
|
trio.run(print_loop)
|
||||||
|
|
||||||
# ensure the sleeps were actually awaited
|
# ensure the sleeps were actually awaited
|
||||||
assert time.time() - start >= 1
|
assert time.time() - start >= 1
|
||||||
|
|
Loading…
Reference in New Issue