diff --git a/tests/test_clustering.py b/tests/test_clustering.py index 92362b58..d04e4d5f 100644 --- a/tests/test_clustering.py +++ b/tests/test_clustering.py @@ -25,14 +25,17 @@ def test_empty_mngrs_input_raises() -> None: ) as portals, gather_contexts( - # NOTE: it's the use of inline-generator syntax - # here that causes the empty input. 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. ), ): - assert 0 + # test should fail if we mk it here! + assert 0, 'Should have raised val-err !?' with pytest.raises(ValueError): trio.run(main) diff --git a/tractor/_clustering.py b/tractor/_clustering.py index 46224d6f..fc4ee68b 100644 --- a/tractor/_clustering.py +++ b/tractor/_clustering.py @@ -55,10 +55,17 @@ async def open_actor_cluster( raise ValueError( 'Number of names is {len(names)} but count it {count}') - async with tractor.open_nursery( - **runtime_kwargs, - ) as an: - async with trio.open_nursery() as n: + async with ( + # tractor.trionics.collapse_eg(), + tractor.open_nursery( + **runtime_kwargs, + ) as an + ): + async with ( + tractor.trionics.collapse_eg(), + trio.open_nursery() as tn, + tractor.trionics.maybe_raise_from_masking_exc() + ): uid = tractor.current_actor().uid async def _start(name: str) -> None: @@ -69,9 +76,8 @@ async def open_actor_cluster( ) for name in names: - n.start_soon(_start, name) + tn.start_soon(_start, name) assert len(portals) == count yield portals - await an.cancel(hard_kill=hard_kill)