From b70f4eafcb5e75a2bbb126edbc9b6d887a38766e Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 8 Mar 2019 20:06:16 -0500 Subject: [PATCH] Flip tests to use `start_method` kwarg --- tests/conftest.py | 4 ++-- tests/test_cancellation.py | 4 ++-- tests/test_spawning.py | 4 ++-- tests/test_streaming.py | 4 ++-- tractor/testing/_tractor_test.py | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 22c77f8..1e46da3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -31,8 +31,8 @@ def arb_addr(): def pytest_generate_tests(metafunc): - if 'spawn_method' in metafunc.fixturenames: + if 'start_method' in metafunc.fixturenames: from multiprocessing import get_all_start_methods methods = get_all_start_methods() methods.remove('fork') - metafunc.parametrize("spawn_method", methods, scope='module') + metafunc.parametrize("start_method", methods, scope='module') diff --git a/tests/test_cancellation.py b/tests/test_cancellation.py index b34c602..e45fbac 100644 --- a/tests/test_cancellation.py +++ b/tests/test_cancellation.py @@ -110,7 +110,7 @@ async def stream_forever(): @tractor_test -async def test_cancel_infinite_streamer(spawn_method): +async def test_cancel_infinite_streamer(start_method): # stream for at most 1 seconds with trio.move_on_after(1) as cancel_scope: @@ -139,7 +139,7 @@ async def test_cancel_infinite_streamer(spawn_method): ids=['one_actor', 'two_actors'], ) @tractor_test -async def test_some_cancels_all(num_actors_and_errs, spawn_method): +async def test_some_cancels_all(num_actors_and_errs, start_method): """Verify a subset of failed subactors causes all others in the nursery to be cancelled just like the strategy in trio. diff --git a/tests/test_spawning.py b/tests/test_spawning.py index 0107115..7508a39 100644 --- a/tests/test_spawning.py +++ b/tests/test_spawning.py @@ -57,7 +57,7 @@ def movie_theatre_question(): @tractor_test -async def test_movie_theatre_convo(spawn_method): +async def test_movie_theatre_convo(start_method): """The main ``tractor`` routine. """ async with tractor.open_nursery() as n: @@ -83,7 +83,7 @@ def cellar_door(): @tractor_test -async def test_most_beautiful_word(spawn_method): +async def test_most_beautiful_word(start_method): """The main ``tractor`` routine. """ async with tractor.open_nursery() as n: diff --git a/tests/test_streaming.py b/tests/test_streaming.py index d77d562..172bb7f 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -62,13 +62,13 @@ async def stream_from_single_subactor(): # await nursery.cancel() -def test_stream_from_single_subactor(arb_addr, spawn_method): +def test_stream_from_single_subactor(arb_addr, start_method): """Verify streaming from a spawned async generator. """ tractor.run( stream_from_single_subactor, arbiter_addr=arb_addr, - spawn_method=spawn_method, + start_method=start_method, ) diff --git a/tractor/testing/_tractor_test.py b/tractor/testing/_tractor_test.py index 341d446..7d8289e 100644 --- a/tractor/testing/_tractor_test.py +++ b/tractor/testing/_tractor_test.py @@ -28,7 +28,7 @@ def tractor_test(fn): *args, loglevel=None, arb_addr=None, - spawn_method='forkserver', + start_method='forkserver', **kwargs ): # __tracebackhide__ = True @@ -40,15 +40,15 @@ def tractor_test(fn): # allows test suites to define a 'loglevel' fixture # that activates the internal logging kwargs['loglevel'] = loglevel - if 'spawn_method' in inspect.signature(fn).parameters: + if 'start_method' in inspect.signature(fn).parameters: # allows test suites to define a 'loglevel' fixture # that activates the internal logging - kwargs['spawn_method'] = spawn_method + kwargs['start_method'] = start_method return run( partial(fn, *args, **kwargs), arbiter_addr=arb_addr, loglevel=loglevel, - spawn_method=spawn_method, + start_method=start_method, ) return wrapper