`tractor.run()` is required for testing now

asyncgen_closing_fix
Tyler Goodlet 2018-07-05 15:33:02 -04:00
parent ae9ab81ff3
commit f6080522f9
1 changed files with 10 additions and 5 deletions

View File

@ -51,7 +51,6 @@ def test_local_actor_async_func():
# NOTE: this func must be defined at module level in order for the # NOTE: this func must be defined at module level in order for the
# interal pickling infra of the forkserver to work # interal pickling infra of the forkserver to work
async def spawn(is_arbiter): async def spawn(is_arbiter):
# name = 'doggy-service'
statespace = {'doggy': 10, 'kitty': 4} statespace = {'doggy': 10, 'kitty': 4}
namespaces = ['piker.brokers.core'] namespaces = ['piker.brokers.core']
@ -72,8 +71,7 @@ async def spawn(is_arbiter):
rpc_module_paths=namespaces, rpc_module_paths=namespaces,
) )
assert len(nursery._children) == 1 assert len(nursery._children) == 1
assert not portal._event.is_set() assert portal.channel.uid in tractor.current_actor()._peers
assert portal._uid in tractor.current_actor()._peers
else: else:
return 10 return 10
@ -88,8 +86,7 @@ def test_local_arbiter_subactor_global_state():
) )
@pytest.mark.trio async def rx_price_quotes_from_brokerd(us_symbols):
async def test_rx_price_quotes_from_brokerd(us_symbols):
"""Verify we can spawn a daemon actor and retrieve streamed price data. """Verify we can spawn a daemon actor and retrieve streamed price data.
""" """
async with tractor.find_actor('brokerd') as portals: async with tractor.find_actor('brokerd') as portals:
@ -136,3 +133,11 @@ async def test_rx_price_quotes_from_brokerd(us_symbols):
# arbitter is cancelled here due to `find_actors()` internals # arbitter is cancelled here due to `find_actors()` internals
# (which internally uses `get_arbiter` which kills its channel # (which internally uses `get_arbiter` which kills its channel
# server scope on exit) # server scope on exit)
def test_rx_price_quotes_from_brokerd(us_symbols):
tractor.run(
rx_price_quotes_from_brokerd,
us_symbols,
name='arbiter',
)