diff --git a/tests/test_cancellation.py b/tests/test_cancellation.py index 1ff7f23..458607d 100644 --- a/tests/test_cancellation.py +++ b/tests/test_cancellation.py @@ -137,7 +137,7 @@ def test_cancel_single_subactor(arb_addr, mechanism): portal = await nursery.start_actor( 'nothin', rpc_module_paths=[__name__], ) - assert (await portal.run(__name__, 'do_nothing')) is None + assert (await portal.run(do_nothing)) is None if mechanism == 'nursery_cancel': # would hang otherwise @@ -173,7 +173,7 @@ async def test_cancel_infinite_streamer(start_method): # this async for loop streams values from the above # async generator running in a separate process - async for letter in await portal.run(__name__, 'stream_forever'): + async for letter in await portal.run(stream_forever): print(letter) # we support trio's cancellation system @@ -247,7 +247,8 @@ async def test_some_cancels_all(num_actors_and_errs, start_method, loglevel): # if this function fails then we should error here # and the nursery should teardown all other actors try: - await portal.run(__name__, func.__name__, **kwargs) + await portal.run(func, **kwargs) + except tractor.RemoteActorError as err: assert err.type == err_type # we only expect this first error to propogate diff --git a/tests/test_pubsub.py b/tests/test_pubsub.py index b963cdb..e55b1d5 100644 --- a/tests/test_pubsub.py +++ b/tests/test_pubsub.py @@ -58,7 +58,7 @@ async def subs( async with tractor.find_actor(pub_actor_name) as portal: stream = await portal.run( - __name__, 'pubber', + pubber, topics=which, seed=seed, ) @@ -76,7 +76,7 @@ async def subs( await stream.aclose() stream = await portal.run( - __name__, 'pubber', + pubber, topics=['odd'], seed=seed, ) diff --git a/tests/test_spawning.py b/tests/test_spawning.py index 0f9db30..a8da2c1 100644 --- a/tests/test_spawning.py +++ b/tests/test_spawning.py @@ -70,9 +70,9 @@ async def test_movie_theatre_convo(start_method): rpc_module_paths=[__name__], ) - print(await portal.run(__name__, 'movie_theatre_question')) + print(await portal.run(movie_theatre_question)) # call the subactor a 2nd time - print(await portal.run(__name__, 'movie_theatre_question')) + print(await portal.run(movie_theatre_question)) # the async with will block here indefinitely waiting # for our actor "frank" to complete, we cancel 'frank' diff --git a/tests/test_streaming.py b/tests/test_streaming.py index 1a48479..45fbd5b 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -50,7 +50,7 @@ async def context_stream(ctx, sequence): assert cs.cancelled_caught -async def stream_from_single_subactor(stream_func_name): +async def stream_from_single_subactor(stream_func): """Verify we can spawn a daemon actor and retrieve streamed data. """ async with tractor.find_actor('streamerd') as portals: @@ -67,8 +67,7 @@ async def stream_from_single_subactor(stream_func_name): seq = range(10) stream = await portal.run( - __name__, - stream_func_name, # one of the funcs above + stream_func, # one of the funcs above sequence=list(seq), # has to be msgpack serializable ) # it'd sure be nice to have an asyncitertools here... @@ -96,7 +95,7 @@ async def stream_from_single_subactor(stream_func_name): @pytest.mark.parametrize( - 'stream_func', ['async_gen_stream', 'context_stream'] + 'stream_func', [async_gen_stream, context_stream] ) def test_stream_from_single_subactor(arb_addr, start_method, stream_func): """Verify streaming from a spawned async generator. @@ -104,7 +103,7 @@ def test_stream_from_single_subactor(arb_addr, start_method, stream_func): tractor.run( partial( stream_from_single_subactor, - stream_func_name=stream_func, + stream_func=stream_func, ), arbiter_addr=arb_addr, start_method=start_method,