문제
코루틴에서 asyncio.ensure_future 을 사용할 때 자세한 함수 추적 정보가 표시되지 않습니다.
해결책
ensure_future 에서 생성된 Future는 생성된 것과 동일한 코루틴에서 기다려야 합니다. 예를 들어, Before 섹션에서 await 는 ensure_future 과 함께 존재하지 않으므로 정보가 누락됩니다.
전에:
import asyncio
async def foo(): ensure_future(bar())
async def bar(): await asyncio.sleep(0.5)후에:
import asyncio
async def foo(): await ensure_future(bar())
async def bar(): await asyncio.sleep(0.5)