Add timeout guard around caller side context open

sigintsaviour_citesthackin
Tyler Goodlet 2022-07-27 15:13:00 -04:00
parent a4bc5f79ad
commit a864f1e729
1 changed files with 30 additions and 28 deletions

View File

@ -265,6 +265,7 @@ async def test_callee_closes_ctx_after_stream_open():
enable_modules=[__name__], enable_modules=[__name__],
) )
with trio.fail_after(2):
async with portal.open_context( async with portal.open_context(
close_ctx_immediately, close_ctx_immediately,
@ -297,6 +298,7 @@ async def test_callee_closes_ctx_after_stream_open():
# of a stream to the context (at least until a time of # of a stream to the context (at least until a time of
# if/when we decide that's a good idea?) # if/when we decide that's a good idea?)
try: try:
with trio.fail_after(0.5):
async with ctx.open_stream() as stream: async with ctx.open_stream() as stream:
pass pass
except trio.ClosedResourceError: except trio.ClosedResourceError: