AsyncioRunner fix - make it return value when connection_observer is used as awaitable
async def xxx():
result_value = await connection_observer
@@ -122,9 +122,10 @@ class AsyncioRunner(ConnectionObserverRunner):
"""
self.logger.debug("go foreground: {!r}".format(connection_observer))
- # connection_observer.start() / runner.submit(connection_observer) has already scheduled future via asyncio.ensure_future
- for step in connection_observer_future.__await__():
- yield step
+ # assuming that connection_observer.start() / runner.submit(connection_observer) has already scheduled future via asyncio.ensure_future
+ assert asyncio.futures.isfuture(connection_observer_future)
+
+ return connection_observer_future.__await__()
# Note: even if code is so simple we can't move it inside ConnectionObserver.__await__() since different runners
# may provide different iterator implementing awaitable
# Here we know, connection_observer_future is asyncio.Future (precisely asyncio.tasks.Task) and we know it has __await__() method.
