Adjust remaining examples and tests for non-backpressure default

stricter_context_starting
Tyler Goodlet 2021-12-05 19:52:09 -05:00
parent 2b05ffcc23
commit 7b9d410c4d
4 changed files with 11 additions and 8 deletions

View File

@ -7,7 +7,7 @@ import tractor
async def stream_data(seed):
for i in range(seed):
yield i
await trio.sleep(0) # trigger scheduler
await trio.sleep(0.0001) # trigger scheduler
# this is the third actor; the aggregator

View File

@ -386,7 +386,8 @@ async def cancel_self(
@tractor_test
async def test_callee_cancels_before_started():
'''callee calls `Context.cancel()` while streaming and caller
'''
Callee calls `Context.cancel()` while streaming and caller
sees stream terminated in `ContextCancelled`.
'''
@ -420,9 +421,10 @@ async def simple_rpc(
data: int,
) -> None:
"""Test a small ping-pong server.
'''
Test a small ping-pong server.
"""
'''
# signal to parent that we're up
await ctx.started(data + 1)
@ -480,9 +482,10 @@ async def simple_rpc_with_forloop(
[simple_rpc, simple_rpc_with_forloop],
)
def test_simple_rpc(server_func, use_async_for):
"""The simplest request response pattern.
'''
The simplest request response pattern.
"""
'''
async def main():
async with tractor.open_nursery() as n:

View File

@ -132,7 +132,7 @@ async def stream_data(seed):
yield i
# trigger scheduler to simulate practical usage
await trio.sleep(0)
await trio.sleep(0.0001)
# this is the third actor; the aggregator

View File

@ -83,7 +83,7 @@ async def open_sequence_streamer(
) as (ctx, first):
assert first is None
async with ctx.open_stream() as stream:
async with ctx.open_stream(backpressure=True) as stream:
yield stream
await portal.cancel_actor()