This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients Mads Sejersen, asvetlov, cjw296, lisroach, mariocj89, michael.foord, xtreak, yselivanov
Date 2020-03-10.09:20:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Thanks for the report. At [0] self.call_args is used. This value is always the last call. So when the object is awaited it will be always the last call object and gets appended. The id of the call objects remain the same. The fix would be to construct the call object with args and kwargs in asynchronous definition of _execute_mock_call like [1]. This would need tests too. It seems there is only test for one await call and assertion over await_args_list. Having different args and kwargs with multiple await to assert await_args_list would help here. In synchronous case the call object is eagerly appended so it won't be an issue.


A potential patch would be as below : 

diff --git a/Lib/unittest/ b/Lib/unittest/
index 9e692981a2..20daf724c1 100644
--- a/Lib/unittest/
+++ b/Lib/unittest/
@@ -2171,7 +2171,7 @@ class AsyncMockMixin(Base):
         # This is nearly just like super(), except for special handling
         # of coroutines
-        _call = self.call_args
+        _call = _Call((args, kwargs), two=True)
         self.await_count += 1
         self.await_args = _call
Date User Action Args
2020-03-10 09:20:14xtreaksetrecipients: + xtreak, cjw296, michael.foord, asvetlov, yselivanov, lisroach, mariocj89, Mads Sejersen
2020-03-10 09:20:14xtreaksetmessageid: <>
2020-03-10 09:20:14xtreaklinkissue39915 messages
2020-03-10 09:20:14xtreakcreate