From 444b9bfc2250b2e2e0e280a1b40554190dd83601 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 24 Jul 2025 18:17:50 -0400 Subject: [PATCH] Fix cluster suite, chng to new `gather_contexts()` Namely `test_empty_mngrs_input_raises()` was failing due to lazy-iterator use as input to `mngrs` which i guess i added support for a while back (by it doing a `list(mngrs)` internally)? So just change it to `gather_contexts(mngrs=())` and also tweak the `trio.fail_after(3)` since it appears that the prior 1sec was causing too-fast-of-a-cancellation (before the cluster fully spawned) and thus the expected `ValueError` never to show.. Also, mask the `tractor.trionics.collapse_eg()` usage (again?) in `open_actor_cluster()` since it seems unnecessary. --- tests/test_clustering.py | 19 +++++++------------ tractor/_clustering.py | 2 +- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/tests/test_clustering.py b/tests/test_clustering.py index d04e4d5f..603b2eb4 100644 --- a/tests/test_clustering.py +++ b/tests/test_clustering.py @@ -13,27 +13,22 @@ MESSAGE = 'tractoring at full speed' def test_empty_mngrs_input_raises() -> None: async def main(): - with trio.fail_after(1): + with trio.fail_after(3): async with ( open_actor_cluster( modules=[__name__], # NOTE: ensure we can passthrough runtime opts - loglevel='info', - # debug_mode=True, + loglevel='cancel', + debug_mode=False, ) as portals, - gather_contexts( - mngrs=( - p.open_context(worker) for p in portals.values() - ), - # ^^NOTE XXX ^^^ - # it's the use of inline-generator syntax here - # that causes the "empty input" -> ValueError, - # see `._clustering` impl. - ), + gather_contexts(mngrs=()), ): + # should fail before this? + assert portals + # test should fail if we mk it here! assert 0, 'Should have raised val-err !?' diff --git a/tractor/_clustering.py b/tractor/_clustering.py index fc4ee68b..dbb50304 100644 --- a/tractor/_clustering.py +++ b/tractor/_clustering.py @@ -62,7 +62,7 @@ async def open_actor_cluster( ) as an ): async with ( - tractor.trionics.collapse_eg(), + # tractor.trionics.collapse_eg(), trio.open_nursery() as tn, tractor.trionics.maybe_raise_from_masking_exc() ):