forked from goodboy/tractor
1
0
Fork 0

Make rpc_module_paths a list

dereg_on_channel_aclose
Tyler Goodlet 2020-08-13 11:53:45 -04:00
parent 8a995beb6a
commit 1ae0efb033
3 changed files with 7 additions and 5 deletions

View File

@ -130,7 +130,7 @@ def daemon(loglevel, testdir, arb_addr):
cmdargs = [ cmdargs = [
sys.executable, '-c', sys.executable, '-c',
"import tractor; tractor.run_daemon((), arbiter_addr={}, loglevel={})" "import tractor; tractor.run_daemon([], arbiter_addr={}, loglevel={})"
.format( .format(
arb_addr, arb_addr,
"'{}'".format(loglevel) if loglevel else None) "'{}'".format(loglevel) if loglevel else None)

View File

@ -4,7 +4,7 @@ tractor: An actor model micro-framework built on
""" """
import importlib import importlib
from functools import partial from functools import partial
from typing import Tuple, Any, Optional from typing import Tuple, Any, Optional, List
import typing import typing
import trio # type: ignore import trio # type: ignore
@ -115,7 +115,7 @@ def run(
def run_daemon( def run_daemon(
rpc_module_paths: Tuple[str], rpc_module_paths: List[str],
**kwargs **kwargs
) -> None: ) -> None:
"""Spawn daemon actor which will respond to RPC. """Spawn daemon actor which will respond to RPC.
@ -124,7 +124,7 @@ def run_daemon(
``tractor.run(trio.sleep(float('inf')))`` such that the first actor spawned ``tractor.run(trio.sleep(float('inf')))`` such that the first actor spawned
is meant to run forever responding to RPC requests. is meant to run forever responding to RPC requests.
""" """
kwargs['rpc_module_paths'] = rpc_module_paths kwargs['rpc_module_paths'] = list(rpc_module_paths)
for path in rpc_module_paths: for path in rpc_module_paths:
importlib.import_module(path) importlib.import_module(path)

View File

@ -2,7 +2,7 @@ import inspect
import platform import platform
from functools import partial, wraps from functools import partial, wraps
from .. import run from tractor import run
__all__ = ['tractor_test'] __all__ = ['tractor_test']
@ -38,6 +38,7 @@ def tractor_test(fn):
# injects test suite fixture value to test as well # injects test suite fixture value to test as well
# as `run()` # as `run()`
kwargs['arb_addr'] = arb_addr kwargs['arb_addr'] = arb_addr
if 'loglevel' in inspect.signature(fn).parameters: if 'loglevel' in inspect.signature(fn).parameters:
# allows test suites to define a 'loglevel' fixture # allows test suites to define a 'loglevel' fixture
# that activates the internal logging # that activates the internal logging
@ -52,6 +53,7 @@ def tractor_test(fn):
if 'start_method' in inspect.signature(fn).parameters: if 'start_method' in inspect.signature(fn).parameters:
# set of subprocess spawning backends # set of subprocess spawning backends
kwargs['start_method'] = start_method kwargs['start_method'] = start_method
return run( return run(
partial(fn, *args, **kwargs), partial(fn, *args, **kwargs),
arbiter_addr=arb_addr, arbiter_addr=arb_addr,