-
Notifications
You must be signed in to change notification settings - Fork 224
Description
I am referring to this part of the receive_output
method:
else:
self.future.cancel()
try:
await self.future
except asyncio.CancelledError:
pass
What I have experienced is that if you, in a test, call receive_output
when there is none available, you not only get a TimeoutError
, but you cannot catch that exception and proceed, because the whole application has been cancelled; any further attempts to receive output, or even reconnect the communicator, will fail with CancelledError
.
There is a question mark in the title because I certainly do not know if this is necessary in some other circumstance! But I don't see a reason to do this, hence raising an issue.
Assuming there is a reason for this then it may help to have some context on why I would want to receive_output
when none is available: it's handy when you don't actually know how much output you're expecting, because you can do something like:
outputs = []
while True:
outputs.append(await communicator.receive_output())
...
Of course, there are checks that one could perform to see whether output is available; but maybe there's no need to. If there is a need, my tests are actually synchronous so performing them is more annoying and costly than it might seem :P