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

2019-09-10 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Closing since docs are updated. Thank you Lisa. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

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

2019-09-10 Thread miss-islington
miss-islington added the comment: New changeset d4391aa5eb4767e19b7b380a836413e7c47f1fb4 by Miss Islington (bot) in branch '3.8': bpo-37383: Updates docs to reflect AsyncMock call_count after await. (GH-15761) https://github.com/python/cpython/commit/d4391aa5eb4767e19b7b380a836413e7c47f1fb4

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

2019-09-09 Thread miss-islington
Change by miss-islington : -- pull_requests: +15460 pull_request: https://github.com/python/cpython/pull/15810 ___ Python tracker ___ __

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

2019-09-09 Thread Lisa Roach
Lisa Roach added the comment: New changeset b9f65f01fd761da7799f36d29b54518399d3458e by Lisa Roach in branch 'master': bpo-37383: Updates docs to reflect AsyncMock call_count after await. (#15761) https://github.com/python/cpython/commit/b9f65f01fd761da7799f36d29b54518399d3458e --

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

2019-09-09 Thread Lisa Roach
Change by Lisa Roach : -- keywords: +patch pull_requests: +15414 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15761 ___ Python tracker ___ _

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

2019-09-09 Thread Lisa Roach
Lisa Roach added the comment: I think you are right, I'd prefer to leave it in. It also helps users who are switching from AsyncTest to the std lib AsyncMock, they can keep using `await_count`. I'll update the docs! -- ___ Python tracker

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

2019-09-09 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan 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_cou

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

2019-09-09 Thread Lisa Roach
Lisa Roach 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? -- ___ Python tracker _

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

2019-09-09 Thread Lisa Roach
Lisa Roach added the comment: Agreed, I think documentation can be clearer around this. I'll add a PR to try to clarify. -- ___ Python tracker ___ ___

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

2019-09-09 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: I just checked the behavior with asynctest. The _mock_call implementation where the call is recorded is similar except that in asynctest it's a synchronous function [0] and in AsyncMock it's an async function [1] thus needs to be awaited to registe

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

2019-09-09 Thread Lisa Roach
Lisa Roach 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

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

2019-06-24 Thread Karthikeyan Singaravelan
New submission from Karthikeyan Singaravelan : I noticed this while working on https://github.com/aio-libs/aiosmtpd/issues/167 where an async function was mocked that now returns an AsyncMock instead of MagicMock. The tests seem to look for call_args, mock_calls etc in the synchronous API wit