From 142083d81b2497b8c64a9d7d286619d7e94ebaa1 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 6 Dec 2021 11:53:15 -0500 Subject: [PATCH] Don't cancel the context on overrun cases --- tests/test_context_streams.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/test_context_streams.py b/tests/test_context_streams.py index 48ccbc8..3117a45 100644 --- a/tests/test_context_streams.py +++ b/tests/test_context_streams.py @@ -97,22 +97,28 @@ def test_one_end_stream_not_opened(overrun_by): enable_modules=[__name__], ) - async with portal.open_context(entrypoint) as (ctx, sent): + async with portal.open_context( + entrypoint, + ) as (ctx, sent): assert sent is None if overrunner in (None, 'caller'): async with ctx.open_stream() as stream: for i in range(buf_size - 1): + await stream.send(i) + + if overrunner is None: + # without this we block waiting on the child side + await ctx.cancel() + + else: await stream.send('yo') else: # callee overruns caller case so we do nothing here await trio.sleep_forever() - # without this we block waiting on the child side - await ctx.cancel() - await portal.cancel_actor() # 2 overrun cases and the no overrun case (which pushes right up to