Always greedily `list`-cast`mngrs` input sequence

harden_cluster_tests
Tyler Goodlet 2022-12-11 19:51:53 -05:00
parent c606be8c64
commit b5192cca8e
1 changed files with 11 additions and 0 deletions

View File

@ -109,6 +109,17 @@ async def gather_contexts(
all_entered = trio.Event() all_entered = trio.Event()
parent_exit = trio.Event() parent_exit = trio.Event()
# XXX: ensure greedy sequence of manager instances
# since a lazy inline generator doesn't seem to work
# with `async with` syntax.
mngrs = list(mngrs)
if not mngrs:
raise ValueError(
'input mngrs is empty?\n'
'Did try to use inline generator syntax?'
)
async with trio.open_nursery() as n: async with trio.open_nursery() as n:
for mngr in mngrs: for mngr in mngrs:
n.start_soon( n.start_soon(