Skip to content

Use unittest.mock if it is available #208

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

Closed
wants to merge 1 commit into from

Conversation

major
Copy link

@major major commented Jun 15, 2021

The python mock module is deprecated in recent Python versions. If unittest.mock is available in the system's python, use that instead.

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)

Fixes #207 🦕

@major major requested a review from a team as a code owner June 15, 2021 14:11
@google-cla
Copy link

google-cla bot commented Jun 15, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no This human has *not* signed the Contributor License Agreement. label Jun 15, 2021
@major
Copy link
Author

major commented Jun 15, 2021

@googlebot I signed it!

@google-cla google-cla bot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Jun 15, 2021
The python mock module is deprecated in recent Python versions. If
unittest.mock is available in the system's python, use that instead.

Fixes: googleapis#207

Signed-off-by: Major Hayden <major@mhtx.net>
@major major force-pushed the fix-mock-import branch from 169bd99 to afc2462 Compare June 15, 2021 14:14
@tseaver
Copy link
Contributor

tseaver commented Jun 15, 2021

@major Thanks for the patch! Rather than add the unittest.mock import conditionally, I think we would prefer to fold in making it unconditional at the same time we drop support for Python 2.7.

@major
Copy link
Author

major commented Jun 15, 2021

@tseaver That's fine -- just thought I'd offer to help! Feel free to close this if you want.

@tseaver tseaver mentioned this pull request Jun 15, 2021
4 tasks
@tseaver
Copy link
Contributor

tseaver commented Jun 15, 2021

Superseded by #210.

@tseaver tseaver closed this Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use unittest.mock if it is available
2 participants