From 1ae0efb03307b4f6ac7204ab76b71c0c570d3864 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 13 Aug 2020 11:53:45 -0400 Subject: [PATCH] Make rpc_module_paths a list --- tests/conftest.py | 2 +- tractor/__init__.py | 6 +++--- tractor/testing/_tractor_test.py | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 8525481..24b0f92 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -130,7 +130,7 @@ def daemon(loglevel, testdir, arb_addr): cmdargs = [ sys.executable, '-c', - "import tractor; tractor.run_daemon((), arbiter_addr={}, loglevel={})" + "import tractor; tractor.run_daemon([], arbiter_addr={}, loglevel={})" .format( arb_addr, "'{}'".format(loglevel) if loglevel else None) diff --git a/tractor/__init__.py b/tractor/__init__.py index 80eaf05..ea61d88 100644 --- a/tractor/__init__.py +++ b/tractor/__init__.py @@ -4,7 +4,7 @@ tractor: An actor model micro-framework built on """ import importlib from functools import partial -from typing import Tuple, Any, Optional +from typing import Tuple, Any, Optional, List import typing import trio # type: ignore @@ -115,7 +115,7 @@ def run( def run_daemon( - rpc_module_paths: Tuple[str], + rpc_module_paths: List[str], **kwargs ) -> None: """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 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: importlib.import_module(path) diff --git a/tractor/testing/_tractor_test.py b/tractor/testing/_tractor_test.py index 3db56e5..65f199f 100644 --- a/tractor/testing/_tractor_test.py +++ b/tractor/testing/_tractor_test.py @@ -2,7 +2,7 @@ import inspect import platform from functools import partial, wraps -from .. import run +from tractor import run __all__ = ['tractor_test'] @@ -38,6 +38,7 @@ def tractor_test(fn): # injects test suite fixture value to test as well # as `run()` kwargs['arb_addr'] = arb_addr + if 'loglevel' in inspect.signature(fn).parameters: # allows test suites to define a 'loglevel' fixture # that activates the internal logging @@ -52,6 +53,7 @@ def tractor_test(fn): if 'start_method' in inspect.signature(fn).parameters: # set of subprocess spawning backends kwargs['start_method'] = start_method + return run( partial(fn, *args, **kwargs), arbiter_addr=arb_addr,