google-auth-library-python icon indicating copy to clipboard operation
google-auth-library-python copied to clipboard

chore: Migrate from mock to unittest.mock

Open clundin25 opened this issue 2 years ago • 5 comments

  • chore: Use stdlib unittest.mock instead of separate mock library. Resolves https://github.com/googleapis/google-auth-library-python/issues/1055
  • Fix mypy error.

clundin25 avatar Jul 25 '23 21:07 clundin25

Looks like mock.AsyncMock is gated by Python 3.8.

I'm considering if we should just gate the Async code to 3.8 in that case, since it's still in "Preview".

@sai-sunder-s @arithmetic1728 @BigTailWolf thoughts?

clundin25 avatar Jul 26 '23 17:07 clundin25

Looks like mock.AsyncMock is gated by Python 3.8.

I'm considering if we should just gate the Async code to 3.8 in that case, since it's still in "Preview".

@sai-sunder-s @arithmetic1728 @BigTailWolf thoughts?

Do we currently have any from unittest.mock import AsyncMock in any test? I searched across ed the repo and didn't see one of them.

BigTailWolf avatar Jul 31 '23 20:07 BigTailWolf

@BigTailWolf It's found in the following files:

❯ rg "AsyncMock" -l
tests_async/oauth2/test__client_async.py
tests_async/oauth2/test_id_token.py
tests_async/oauth2/test_reauth_async.py
tests_async/oauth2/test_service_account_async.py
tests_async/oauth2/test_credentials_async.py
tests_async/transport/test_aiohttp_requests.py

clundin25 avatar Jul 31 '23 20:07 clundin25

Hi! :wave:

We are currently (finally) removing the python-mock package on Arch Linux. I am therefore very interested in this getting merged and released. Are there still specific blockers?

dvzrv avatar Mar 05 '24 09:03 dvzrv