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.
POST_final_eg_refinements_failafter_investigation
Tyler Goodlet 2025-07-24 18:17:50 -04:00
parent 79e70a9b08
commit 444b9bfc22
2 changed files with 8 additions and 13 deletions

View File

@ -13,27 +13,22 @@ MESSAGE = 'tractoring at full speed'
def test_empty_mngrs_input_raises() -> None: def test_empty_mngrs_input_raises() -> None:
async def main(): async def main():
with trio.fail_after(1): with trio.fail_after(3):
async with ( async with (
open_actor_cluster( open_actor_cluster(
modules=[__name__], modules=[__name__],
# NOTE: ensure we can passthrough runtime opts # NOTE: ensure we can passthrough runtime opts
loglevel='info', loglevel='cancel',
# debug_mode=True, debug_mode=False,
) as portals, ) as portals,
gather_contexts( gather_contexts(mngrs=()),
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.
),
): ):
# should fail before this?
assert portals
# test should fail if we mk it here! # test should fail if we mk it here!
assert 0, 'Should have raised val-err !?' assert 0, 'Should have raised val-err !?'

View File

@ -62,7 +62,7 @@ async def open_actor_cluster(
) as an ) as an
): ):
async with ( async with (
tractor.trionics.collapse_eg(), # tractor.trionics.collapse_eg(),
trio.open_nursery() as tn, trio.open_nursery() as tn,
tractor.trionics.maybe_raise_from_masking_exc() tractor.trionics.maybe_raise_from_masking_exc()
): ):