diff --git a/tests/test_streaming.py b/tests/test_streaming.py index e25a000..55b4bee 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -91,25 +91,25 @@ async def aggregate(seed): portals.append(portal) - q = trio.Queue(500) + send_chan, recv_chan = trio.open_memory_channel(500) - async def push_to_q(portal): + async def push_to_chan(portal): async for value in await portal.run( __name__, 'stream_data', seed=seed ): # leverage trio's built-in backpressure - await q.put(value) + await send_chan.send(value) - await q.put(None) + await send_chan.send(None) print(f"FINISHED ITERATING {portal.channel.uid}") # spawn 2 trio tasks to collect streams and push to a local queue async with trio.open_nursery() as n: for portal in portals: - n.start_soon(push_to_q, portal) + n.start_soon(push_to_chan, portal) unique_vals = set() - async for value in q: + async for value in recv_chan: if value not in unique_vals: unique_vals.add(value) # yield upwards to the spawning parent actor