From 43cca122f5eab44bb551849860f2b9072ad51955 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 26 Jan 2020 23:44:47 -0500 Subject: [PATCH] Handle windows in `@tractor_test` as well --- tractor/testing/_tractor_test.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tractor/testing/_tractor_test.py b/tractor/testing/_tractor_test.py index 82f38f2..5ca82a6 100644 --- a/tractor/testing/_tractor_test.py +++ b/tractor/testing/_tractor_test.py @@ -1,4 +1,5 @@ import inspect +import platform from functools import partial, wraps from .. import run @@ -29,7 +30,7 @@ def tractor_test(fn): *args, loglevel=None, arb_addr=None, - start_method='trio_run_in_process', + start_method=None, **kwargs ): # __tracebackhide__ = True @@ -41,6 +42,13 @@ def tractor_test(fn): # allows test suites to define a 'loglevel' fixture # that activates the internal logging kwargs['loglevel'] = loglevel + + if start_method is None: + if platform.system() == "Windows": + start_method = 'spawn' + else: + start_method = 'trio_run_in_process' + if 'start_method' in inspect.signature(fn).parameters: # set of subprocess spawning backends kwargs['start_method'] = start_method