GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@s-t-e-v-e-n-k 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.

Copy link
Copy Markdown
Contributor

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.

All reactions
@s-t-e-v-e-n-k
s-t-e-v-e-n-k requested review from a team October 2, 2024 03:53
@product-auto-label product-auto-label Bot added the size: m Pull request size is medium. label Oct 2, 2024
@blunderbuss-gcf blunderbuss-gcf Bot assigned ohmayr Oct 2, 2024
@s-t-e-v-e-n-k
test: Switch to unittest.mock from mock
5f28e21
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
s-t-e-v-e-n-k force-pushed the switch-to-unittest-mock branch from 4db4bbf to 5f28e21 Compare October 2, 2024 03:54
@ohmayr

ohmayr commented Oct 2, 2024

Copy link
Copy Markdown
Contributor

@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@s-t-e-v-e-n-k

s-t-e-v-e-n-k commented Oct 3, 2024

Copy link
Copy Markdown
Contributor Author

Ahh, indeed, AsyncMock was added in 3.8. I'll modify this accordingly.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@s-t-e-v-e-n-k
test: Fallback to external mock for AsyncMock
5583db4
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.
@s-t-e-v-e-n-k
s-t-e-v-e-n-k force-pushed the switch-to-unittest-mock branch from 98f3bec to 5583db4 Compare October 3, 2024 11:44
@parthea parthea self-assigned this Oct 9, 2024
@parthea parthea changed the title Switch to unittest.mock from mock fix: Switch to unittest.mock from mock Oct 9, 2024
parthea added 5 commits October 9, 2024 09:52
@parthea
Merge branch 'main' into switch-to-unittest-mock
4873a22
@parthea
lint
216eea8
@parthea
clean up to satisfy mypy
df2ce10
@parthea
lint
e934f87
@parthea
fix build
8f99f51
ohmayr
ohmayr approved these changes Oct 9, 2024
View reviewed changes
@parthea
parthea merged commit 8c53381 into googleapis:main Oct 9, 2024
@release-please release-please Bot mentioned this pull request Oct 9, 2024
chore(main): release 2.22.0 #729
Merged
@parthea parthea mentioned this pull request Oct 23, 2024
chore: Release candidate v2.22.0rc0 #745
Closed
This was referenced May 30, 2025
chore(main): release 2.0.0 #822
Closed
chore(main): release 2.0.0 #823
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer
@ohmayr 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.

Assignees

@parthea parthea

@ohmayr ohmayr

Labels

size: m Pull request size is medium.

Projects

None yet

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.

3 participants

@s-t-e-v-e-n-k @ohmayr @parthea
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.