forked from goodboy/tractor
Don't cancel the context on overrun cases
parent
318027ebd1
commit
142083d81b
|
@ -97,22 +97,28 @@ def test_one_end_stream_not_opened(overrun_by):
|
||||||
enable_modules=[__name__],
|
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
|
assert sent is None
|
||||||
|
|
||||||
if overrunner in (None, 'caller'):
|
if overrunner in (None, 'caller'):
|
||||||
|
|
||||||
async with ctx.open_stream() as stream:
|
async with ctx.open_stream() as stream:
|
||||||
for i in range(buf_size - 1):
|
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')
|
await stream.send('yo')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# callee overruns caller case so we do nothing here
|
# callee overruns caller case so we do nothing here
|
||||||
await trio.sleep_forever()
|
await trio.sleep_forever()
|
||||||
|
|
||||||
# without this we block waiting on the child side
|
|
||||||
await ctx.cancel()
|
|
||||||
|
|
||||||
await portal.cancel_actor()
|
await portal.cancel_actor()
|
||||||
|
|
||||||
# 2 overrun cases and the no overrun case (which pushes right up to
|
# 2 overrun cases and the no overrun case (which pushes right up to
|
||||||
|
|
Loading…
Reference in New Issue