GeezerVison is showing github.com — fix: Switch to unittest.mock from mock by s-t-e-v-e-n-k · Pull Request #713 · googleapis/python-api-core
This repository was archived by the owner on Feb 23, 2026. It is now read-only.
Conversation
s-t-e-v-e-n-k
commented
Oct 2, 2024
•
edited by parthea
Loading
Uh oh!
There was an error while loading. Please reload this page.
Now that the minimum supported version of Python is 3.7, we can stop using the external mock requirement, and import it from unittest. I have also attempted to keep imports ordered.
Fixes #377
Closes #676
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
- Ensure the tests and linter pass
- Code coverage does not decrease (if any source code was changed)
- Appropriate docs were updated (if necessary)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Now that the minimum supported version of Python is 3.7, we can stop
using the external mock requirement, and import it from unittest. I have
also attempted to keep imports ordered.
Fixes googleapis#377
|
@s-t-e-v-e-n-k, general comment: AsyncMock isn't part of the stdlib i.e. unitest.mock for Python 3.7. which we're using in our test code.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Ahh, indeed, AsyncMock was added in 3.8. I'll modify this accordingly.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
AsyncMock is not included in unittest.mock under Python 3.7, so we must
fallback to the external mock requirement for that Python version. Only
install it for that version.
Keep this as a separate commit so it can be reverted when 3.7 isn't
supported anymore.
parthea
changed the title
Switch to unittest.mock from mock
fix: Switch to unittest.mock from mock
Oct 9, 2024
This was referenced May 30, 2025
Reviewers
1 more reviewer
ohmayr
ohmayr approved these changes
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Labels
size: m
Pull request size is medium.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
use unittest.mock instead of mock
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|