From 93726f139260c4fa4add047e62a2894882c2ec08 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 6 Sep 2021 11:42:49 -0400 Subject: [PATCH] Call registry getter method in test --- tests/test_discovery.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/test_discovery.py b/tests/test_discovery.py index 383608e..1fa3f5f 100644 --- a/tests/test_discovery.py +++ b/tests/test_discovery.py @@ -136,7 +136,7 @@ async def spawn_and_check_registry( if actor.is_arbiter: async def get_reg(): - return actor._registry + return await actor.get_registry() extra = 1 # arbiter is local root actor else: @@ -187,13 +187,12 @@ async def spawn_and_check_registry( await cancel(use_signal) finally: - with trio.CancelScope(shield=True): - await trio.sleep(0.5) + await trio.sleep(0.5) - # all subactors should have de-registered - registry = await get_reg() - assert len(registry) == extra - assert actor.uid in registry + # all subactors should have de-registered + registry = await get_reg() + assert len(registry) == extra + assert actor.uid in registry @pytest.mark.parametrize('use_signal', [False, True]) @@ -277,7 +276,9 @@ async def close_chans_before_nursery( # TODO: compact this back as was in last commit once # 3.9+, see https://github.com/goodboy/tractor/issues/207 - async with portal1.open_stream_from(stream_forever) as agen1: + async with portal1.open_stream_from( + stream_forever + ) as agen1: async with portal2.open_stream_from( stream_forever ) as agen2: @@ -293,8 +294,9 @@ async def close_chans_before_nursery( # reliably triggered by an external SIGINT. # tractor.current_actor()._root_nursery.cancel_scope.cancel() - # XXX: THIS IS THE KEY THING that happens - # **before** exiting the actor nursery block + # XXX: THIS IS THE KEY THING that + # happens **before** exiting the + # actor nursery block # also kill off channels cuz why not await agen1.aclose()