-
-
Notifications
You must be signed in to change notification settings - Fork 32k
bpo-38163: Child mocks detect their type as sync or async #16471
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
Conversation
Thanks @lisroach for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
I'm having trouble backporting to |
Thanks @lisroach for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
Sorry @lisroach, I had trouble checking out the |
…onGH-16471) (cherry picked from commit 3667e1e) Co-authored-by: Lisa Roach <[email protected]>
GH-16484 is a backport of this pull request to the 3.8 branch. |
This should be the last diff to get the child mocks detecting their type as either synchronous or asynchronous and returning AsyncMock or MagicMock (or Mock) depending on their type.
The main goal is for classes that have a mix of asynchronous and synchronous methods to auto-detect whether they should be AsyncMock or a synchronous mocks. Example:
This defies Mock's typical functionality where all child mocks follow the type of their parent mock, but after some discussion I believe the auto-detection is more important to the typical user than a consistency with current Mock style.
https://bugs.python.org/issue38163