Lisa Roach <lisaroac...@gmail.com> added the comment:

I see your point it is confusing the difference between the async and sync API, 
but I think the current AsyncMock call check is correct. According to the 
asyncio docs: "...simply calling a coroutine will not schedule it to be 
executed" (https://docs.python.org/3/library/asyncio-task.html#coroutines) and 
it goes on to say you either need to call the function with await, 
asyncio.run(), or asyncio.create_task(). 

So I believe calling an AsyncMock without using await should not log as a call, 
it is only if one of the three criteria above is met that it should be added to 
the mock_calls list.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37383>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to