New submission from Jason Fried <m...@jasonfried.info>:
If you are trying to use AsyncMock to mock a coroutine that returns awaitable objects, AsyncMock awaits on those objects instead of returning them as is. Example: mock = AsyncMock(return_value=asyncio.Future()) v = await mock() # blocks on trying to await the future Expected: mock = AsyncMock(return_value=asyncio.Future()) v = await mock() assert isisnstance(v, asyncio.Future) This problem affects side_effects and wraps. ---------- components: Library (Lib) messages: 357000 nosy: fried, lisroach priority: normal severity: normal status: open title: AsyncMock issue with awaitable return_value/side_effect/wraps versions: Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38857> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com