Skip to content

bpo-38136: Updates await_count and call_count to be different things #16192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Sep 24, 2019

Conversation

lisroach
Copy link
Contributor

@lisroach lisroach commented Sep 16, 2019

After a lot of discussion we have decided that "calls" and "awaits" should be counted as two different things.

To accomplish this I separated the call counting from the actual execution of the call, that way they are counted at two different times. For synchronous calls the increment and execute calls happen one immediately after another, but for asynchronous calls the increment count for call count happens first, and then only after await is called does the call execute and increment the await counters.

https://bugs.python.org/issue38136

@tirkarthi
Copy link
Member

Does this mean we have to revert the doc updated added in #15761 ?

@lisroach
Copy link
Contributor Author

@tirkarthi yes, I can actually just remove that doc change with this PR.

@@ -2017,7 +2018,7 @@ def trace(frame, event, arg): # pragma: no cover
)

mocks = [
Mock, MagicMock, NonCallableMock, NonCallableMagicMock
Mock, MagicMock, NonCallableMock, NonCallableMagicMock, AsyncMock
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been thinking to add this. Thanks for doing it. It also needs to be added for EventMock in the other PR just to make sure there is no regression.

@bedevere-bot
Copy link

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@lisroach lisroach merged commit ef04851 into python:master Sep 24, 2019
@lisroach lisroach deleted the fix_call_count branch September 24, 2019 03:49
@miss-islington
Copy link
Contributor

Thanks @lisroach for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @lisroach, I could not cleanly backport this to 3.8 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker ef048517755db1f0d211fb6dfc655a8b412cc96f 3.8

lisroach added a commit to lisroach/cpython that referenced this pull request Sep 26, 2019
@bedevere-bot
Copy link

GH-16431 is a backport of this pull request to the 3.8 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants