How to mock aiohttp.client.ClientSession.get async context manager
In your link, there is an edit: EDIT: A GitHub issue mentioned in this post has been resolved and as of version 0.11.1 asynctest supports asynchronous context managers out of the box. Since asynctest==0.11.1, it was changed, a working example is: import random from aiohttp import ClientSession from asynctest import CoroutineMock, patch async def get_random_photo_url(): … Read more