Skip to content
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

fix(deps): use mock from stdlib in tests #488

Closed
wants to merge 3 commits into from
Closed

fix(deps): use mock from stdlib in tests #488

wants to merge 3 commits into from

Conversation

maxwell-k
Copy link

@maxwell-k maxwell-k commented Apr 15, 2020

This change removes an unnecessary dependency in the tests.

The mock package is a backport of functionality from the Python 3.3 standard library to Python 2.7. This library is not supported on Python 2.7. Using import mock instead of from unittest import mock adds an unnecessary dependency, for no apparent gain.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 15, 2020
@maxwell-k maxwell-k changed the title Use mock from stdlib in test_mtls.py fix(deps): use mock from stdlib in test_mtls.py Apr 15, 2020
@maxwell-k maxwell-k changed the title fix(deps): use mock from stdlib in test_mtls.py fix(deps): use mock from stdlib in tests May 19, 2020
This change removes an unnecessary dependency in the tests.

The [mock package] is a backport of functionality from the Python 3.3 standard library to Python 2.7. google-auth-library-python is [not supported] on
Python 2.7. Using `import mock` instead of `from unittest import mock` adds an unnecessary dependency, for no apparent gain.

[mock package]: https://pypi.org/project/mock/
[not supported]: https://github.com/googleapis/google-auth-library-python#deprecated-python-versions
@tseaver
Copy link
Contributor

tseaver commented Jul 21, 2020

@maxwell-k Thanks for the patch. However, Python 2.7 support is deprecated, but still present. Until we drop it entirely (including from CI / nox), we cannot rely on the stdlib to have unittest.mock.

@tseaver tseaver added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jul 21, 2020
@busunkim96 busunkim96 closed this Jul 31, 2020
@busunkim96 busunkim96 reopened this Jul 31, 2020
@tseaver tseaver requested review from arithmetic1728, silvolu and a team as code owners August 6, 2021 19:27
@tseaver tseaver added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 6, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 6, 2021
@tseaver tseaver closed this Aug 6, 2021
@tseaver
Copy link
Contributor

tseaver commented Aug 6, 2021

@maxwell-k I'm sorry not to be able to merge this PR. While working on #778, I found that we cannot drop the mock compatibility library, because we rely on mock.AsyncMock, which is not present in the stdlib version before Python 3.8.

@maxwell-k maxwell-k deleted the patch-1 branch November 22, 2021 21:34
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. do not merge Indicates a pull request not ready for merge, due to either quality or timing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants