[issue37383] call count in not registered in AsyncMock till the coroutine is awaited

Karthikeyan Singaravelan report at bugs.python.org
Mon Sep 9 06:50:23 EDT 2019


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

> I wonder if `await_count` is really necessary, since it is essentially the same as `call_count`. Would it be too late or confusing to remove it now?

IMO if we are to document that mock_calls is recorded over await then we can have both call_count and await_count because if users start using AsyncMock then they can keep using the call_* functions. Removing it would mean there are also other counterparts as below to make sure we keep or remove all to remove discrepancy. I am more leaned towards keeping them and document it.

>>> m.await
m.await_args      m.await_args_list m.await_count     m.awaited
>>> m.call
m.call_args      m.call_args_list m.call_count     m.called

With respect to removal I think the window is still open till the 3.8.0RC1.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37383>
_______________________________________


More information about the Python-bugs-list mailing list