diff --git a/system_tests/system_tests_sync/test_mtls_http.py b/system_tests/system_tests_sync/test_mtls_http.py index bcf2a59da..20836ad43 100644 --- a/system_tests/system_tests_sync/test_mtls_http.py +++ b/system_tests/system_tests_sync/test_mtls_http.py @@ -13,7 +13,7 @@ # limitations under the License. import json -import mock +from unittest import mock import os import time from os import path diff --git a/testing/requirements.txt b/testing/requirements.txt index 27a0b3cb7..ccb53b061 100644 --- a/testing/requirements.txt +++ b/testing/requirements.txt @@ -1,7 +1,6 @@ # Unit test requirements flask freezegun -mock oauth2client pyopenssl pytest diff --git a/tests/compute_engine/test__metadata.py b/tests/compute_engine/test__metadata.py index f0e432979..11bf6c5d5 100644 --- a/tests/compute_engine/test__metadata.py +++ b/tests/compute_engine/test__metadata.py @@ -17,8 +17,8 @@ import importlib import json import os +from unittest import mock -import mock import pytest # type: ignore from google.auth import _helpers diff --git a/tests/compute_engine/test_credentials.py b/tests/compute_engine/test_credentials.py index 507fea9fc..d6ca02bd6 100644 --- a/tests/compute_engine/test_credentials.py +++ b/tests/compute_engine/test_credentials.py @@ -13,8 +13,8 @@ # limitations under the License. import base64 import datetime +from unittest import mock -import mock import pytest # type: ignore import responses # type: ignore diff --git a/tests/conftest.py b/tests/conftest.py index 8080ec3fa..fbce2575e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -14,8 +14,8 @@ import os import sys +from unittest import mock -import mock import pytest # type: ignore diff --git a/tests/crypt/test__python_rsa.py b/tests/crypt/test__python_rsa.py index 4a4ebe44e..ec51e16bb 100644 --- a/tests/crypt/test__python_rsa.py +++ b/tests/crypt/test__python_rsa.py @@ -15,8 +15,8 @@ import io import json import os +from unittest import mock -import mock from pyasn1_modules import pem # type: ignore import pytest # type: ignore import rsa # type: ignore diff --git a/tests/oauth2/test__client.py b/tests/oauth2/test__client.py index 4cbd3a8ad..bff2aa46e 100644 --- a/tests/oauth2/test__client.py +++ b/tests/oauth2/test__client.py @@ -16,9 +16,9 @@ import http.client as http_client import json import os +from unittest import mock import urllib -import mock import pytest # type: ignore from google.auth import _helpers diff --git a/tests/oauth2/test_challenges.py b/tests/oauth2/test_challenges.py index a06f55283..f156f57d8 100644 --- a/tests/oauth2/test_challenges.py +++ b/tests/oauth2/test_challenges.py @@ -16,8 +16,8 @@ import base64 import sys +from unittest import mock -import mock import pytest # type: ignore import pyu2f # type: ignore diff --git a/tests/oauth2/test_credentials.py b/tests/oauth2/test_credentials.py index d265d22ed..88c63e9f5 100644 --- a/tests/oauth2/test_credentials.py +++ b/tests/oauth2/test_credentials.py @@ -17,8 +17,8 @@ import os import pickle import sys +from unittest import mock -import mock import pytest # type: ignore from google.auth import _helpers diff --git a/tests/oauth2/test_gdch_credentials.py b/tests/oauth2/test_gdch_credentials.py index 63075aba0..b889744e6 100644 --- a/tests/oauth2/test_gdch_credentials.py +++ b/tests/oauth2/test_gdch_credentials.py @@ -16,8 +16,8 @@ import datetime import json import os +from unittest import mock -import mock import pytest # type: ignore import requests diff --git a/tests/oauth2/test_id_token.py b/tests/oauth2/test_id_token.py index 40204f9d4..cdc4d3d61 100644 --- a/tests/oauth2/test_id_token.py +++ b/tests/oauth2/test_id_token.py @@ -14,8 +14,8 @@ import json import os +from unittest import mock -import mock import pytest # type: ignore from google.auth import environment_vars diff --git a/tests/oauth2/test_reauth.py b/tests/oauth2/test_reauth.py index a95367a2b..ef19e4c84 100644 --- a/tests/oauth2/test_reauth.py +++ b/tests/oauth2/test_reauth.py @@ -13,8 +13,8 @@ # limitations under the License. import copy +from unittest import mock -import mock import pytest # type: ignore from google.auth import exceptions diff --git a/tests/oauth2/test_service_account.py b/tests/oauth2/test_service_account.py index b963b157c..03d9fd686 100644 --- a/tests/oauth2/test_service_account.py +++ b/tests/oauth2/test_service_account.py @@ -15,8 +15,8 @@ import datetime import json import os +from unittest import mock -import mock import pytest # type: ignore from google.auth import _helpers diff --git a/tests/oauth2/test_sts.py b/tests/oauth2/test_sts.py index e0fb4ae23..395aac9bc 100644 --- a/tests/oauth2/test_sts.py +++ b/tests/oauth2/test_sts.py @@ -14,9 +14,9 @@ import http.client as http_client import json +from unittest import mock import urllib -import mock import pytest # type: ignore from google.auth import exceptions diff --git a/tests/test__cloud_sdk.py b/tests/test__cloud_sdk.py index e45c65bd9..dd14bcebe 100644 --- a/tests/test__cloud_sdk.py +++ b/tests/test__cloud_sdk.py @@ -17,8 +17,8 @@ import os import subprocess import sys +from unittest import mock -import mock import pytest # type: ignore from google.auth import _cloud_sdk diff --git a/tests/test__default.py b/tests/test__default.py index 4f59c5497..a9a06eb78 100644 --- a/tests/test__default.py +++ b/tests/test__default.py @@ -14,8 +14,8 @@ import json import os +from unittest import mock -import mock import pytest # type: ignore from google.auth import _default diff --git a/tests/test__exponential_backoff.py b/tests/test__exponential_backoff.py index 06a54527e..a1b9540d1 100644 --- a/tests/test__exponential_backoff.py +++ b/tests/test__exponential_backoff.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from google.auth import _exponential_backoff diff --git a/tests/test__oauth2client.py b/tests/test__oauth2client.py index 9f0c192ae..52276ae5c 100644 --- a/tests/test__oauth2client.py +++ b/tests/test__oauth2client.py @@ -16,8 +16,8 @@ import importlib import os import sys +from unittest import mock -import mock import pytest # type: ignore try: diff --git a/tests/test_app_engine.py b/tests/test_app_engine.py index ca085bd69..10b7bf371 100644 --- a/tests/test_app_engine.py +++ b/tests/test_app_engine.py @@ -13,8 +13,8 @@ # limitations under the License. import datetime +from unittest import mock -import mock import pytest # type: ignore from google.auth import app_engine diff --git a/tests/test_aws.py b/tests/test_aws.py index db2e98410..7319f2539 100644 --- a/tests/test_aws.py +++ b/tests/test_aws.py @@ -16,9 +16,9 @@ import http.client as http_client import json import os +from unittest import mock import urllib.parse -import mock import pytest # type: ignore from google.auth import _helpers diff --git a/tests/test_downscoped.py b/tests/test_downscoped.py index b011380bd..7507480a0 100644 --- a/tests/test_downscoped.py +++ b/tests/test_downscoped.py @@ -15,9 +15,9 @@ import datetime import http.client as http_client import json +from unittest import mock import urllib -import mock import pytest # type: ignore from google.auth import _helpers diff --git a/tests/test_external_account.py b/tests/test_external_account.py index 6f6e18b2c..9ec154901 100644 --- a/tests/test_external_account.py +++ b/tests/test_external_account.py @@ -15,9 +15,9 @@ import datetime import http.client as http_client import json +from unittest import mock import urllib -import mock import pytest # type: ignore from google.auth import _helpers diff --git a/tests/test_external_account_authorized_user.py b/tests/test_external_account_authorized_user.py index 7ffd5078c..e95c1fbdb 100644 --- a/tests/test_external_account_authorized_user.py +++ b/tests/test_external_account_authorized_user.py @@ -15,8 +15,8 @@ import datetime import http.client as http_client import json +from unittest import mock -import mock import pytest # type: ignore from google.auth import exceptions diff --git a/tests/test_iam.py b/tests/test_iam.py index 6706afb4b..9a70713a7 100644 --- a/tests/test_iam.py +++ b/tests/test_iam.py @@ -16,8 +16,8 @@ import datetime import http.client as http_client import json +from unittest import mock -import mock import pytest # type: ignore from google.auth import _helpers diff --git a/tests/test_identity_pool.py b/tests/test_identity_pool.py index 8821df088..ae5773078 100644 --- a/tests/test_identity_pool.py +++ b/tests/test_identity_pool.py @@ -16,9 +16,9 @@ import http.client as http_client import json import os +from unittest import mock import urllib -import mock import pytest # type: ignore from google.auth import _helpers diff --git a/tests/test_impersonated_credentials.py b/tests/test_impersonated_credentials.py index 9eb04b134..45de89bd0 100644 --- a/tests/test_impersonated_credentials.py +++ b/tests/test_impersonated_credentials.py @@ -16,8 +16,8 @@ import http.client as http_client import json import os +from unittest import mock -import mock import pytest # type: ignore from google.auth import _helpers diff --git a/tests/test_jwt.py b/tests/test_jwt.py index 28660ea33..3029d6f1d 100644 --- a/tests/test_jwt.py +++ b/tests/test_jwt.py @@ -16,8 +16,8 @@ import datetime import json import os +from unittest import mock -import mock import pytest # type: ignore from google.auth import _helpers diff --git a/tests/test_metrics.py b/tests/test_metrics.py index ba9389267..b9036e38d 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -13,8 +13,8 @@ # limitations under the License. import platform +from unittest import mock -import mock from google.auth import metrics from google.auth import version diff --git a/tests/test_pluggable.py b/tests/test_pluggable.py index 1773b40d4..18afa2a06 100644 --- a/tests/test_pluggable.py +++ b/tests/test_pluggable.py @@ -15,8 +15,8 @@ import json import os import subprocess +from unittest import mock -import mock import pytest # type: ignore from google.auth import exceptions diff --git a/tests/transport/test__custom_tls_signer.py b/tests/transport/test__custom_tls_signer.py index 5836b325a..cea40a68a 100644 --- a/tests/transport/test__custom_tls_signer.py +++ b/tests/transport/test__custom_tls_signer.py @@ -15,8 +15,8 @@ import base64 import ctypes import os +from unittest import mock -import mock import pytest # type: ignore from requests.packages.urllib3.util.ssl_ import create_urllib3_context # type: ignore import urllib3.contrib.pyopenssl # type: ignore diff --git a/tests/transport/test__mtls_helper.py b/tests/transport/test__mtls_helper.py index 1621a0530..20e07ec49 100644 --- a/tests/transport/test__mtls_helper.py +++ b/tests/transport/test__mtls_helper.py @@ -14,8 +14,8 @@ import os import re +from unittest import mock -import mock from OpenSSL import crypto import pytest # type: ignore diff --git a/tests/transport/test_grpc.py b/tests/transport/test_grpc.py index f62ab0eae..208ee5a56 100644 --- a/tests/transport/test_grpc.py +++ b/tests/transport/test_grpc.py @@ -15,8 +15,8 @@ import datetime import os import time +from unittest import mock -import mock import pytest # type: ignore from google.auth import _helpers diff --git a/tests/transport/test_mtls.py b/tests/transport/test_mtls.py index b62063e47..71c6d873b 100644 --- a/tests/transport/test_mtls.py +++ b/tests/transport/test_mtls.py @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock + import pytest # type: ignore from google.auth import exceptions diff --git a/tests/transport/test_requests.py b/tests/transport/test_requests.py index d96281434..c3143b60c 100644 --- a/tests/transport/test_requests.py +++ b/tests/transport/test_requests.py @@ -17,9 +17,9 @@ import http.client as http_client import os import sys +from unittest import mock import freezegun -import mock import OpenSSL import pytest # type: ignore import requests diff --git a/tests/transport/test_urllib3.py b/tests/transport/test_urllib3.py index e83230032..50044df15 100644 --- a/tests/transport/test_urllib3.py +++ b/tests/transport/test_urllib3.py @@ -15,8 +15,8 @@ import http.client as http_client import os import sys +from unittest import mock -import mock import OpenSSL import pytest # type: ignore import urllib3 # type: ignore diff --git a/tests_async/conftest.py b/tests_async/conftest.py index f13dec0e4..55fd26463 100644 --- a/tests_async/conftest.py +++ b/tests_async/conftest.py @@ -14,8 +14,8 @@ import os import sys +from unittest import mock -import mock import pytest # type: ignore diff --git a/tests_async/oauth2/test__client_async.py b/tests_async/oauth2/test__client_async.py index add1b4e60..4b84ad20c 100644 --- a/tests_async/oauth2/test__client_async.py +++ b/tests_async/oauth2/test__client_async.py @@ -15,9 +15,9 @@ import datetime import http.client as http_client import json +from unittest import mock import urllib -import mock import pytest # type: ignore from google.auth import _helpers diff --git a/tests_async/oauth2/test_credentials_async.py b/tests_async/oauth2/test_credentials_async.py index a328cc3cb..ca5af9ce8 100644 --- a/tests_async/oauth2/test_credentials_async.py +++ b/tests_async/oauth2/test_credentials_async.py @@ -17,8 +17,8 @@ import os import pickle import sys +from unittest import mock -import mock import pytest # type: ignore from google.auth import _helpers diff --git a/tests_async/oauth2/test_id_token.py b/tests_async/oauth2/test_id_token.py index 9be086dca..51d85daf2 100644 --- a/tests_async/oauth2/test_id_token.py +++ b/tests_async/oauth2/test_id_token.py @@ -14,8 +14,8 @@ import json import os +from unittest import mock -import mock import pytest # type: ignore from google.auth import environment_vars diff --git a/tests_async/oauth2/test_reauth_async.py b/tests_async/oauth2/test_reauth_async.py index 40ca92717..4b3e28edd 100644 --- a/tests_async/oauth2/test_reauth_async.py +++ b/tests_async/oauth2/test_reauth_async.py @@ -13,8 +13,8 @@ # limitations under the License. import copy +from unittest import mock -import mock import pytest # type: ignore from google.auth import exceptions @@ -22,7 +22,7 @@ from google.oauth2 import reauth -MOCK_REQUEST = mock.AsyncMock(spec=["transport.Request"]) +MOCK_REQUEST = mock.AsyncMock(spec=["transport.Request"]) # type: ignore CHALLENGES_RESPONSE_TEMPLATE = { "status": "CHALLENGE_REQUIRED", "sessionId": "123", diff --git a/tests_async/oauth2/test_service_account_async.py b/tests_async/oauth2/test_service_account_async.py index 176992f77..5a9a89fca 100644 --- a/tests_async/oauth2/test_service_account_async.py +++ b/tests_async/oauth2/test_service_account_async.py @@ -13,8 +13,8 @@ # limitations under the License. import datetime +from unittest import mock -import mock import pytest # type: ignore from google.auth import _helpers diff --git a/tests_async/test__default_async.py b/tests_async/test__default_async.py index e1dbb1c09..a1268bdc0 100644 --- a/tests_async/test__default_async.py +++ b/tests_async/test__default_async.py @@ -14,8 +14,8 @@ import json import os +from unittest import mock -import mock import pytest # type: ignore from google.auth import _credentials_async as credentials diff --git a/tests_async/test_jwt_async.py b/tests_async/test_jwt_async.py index f24a0a99d..9d9eca4e2 100644 --- a/tests_async/test_jwt_async.py +++ b/tests_async/test_jwt_async.py @@ -14,8 +14,8 @@ import datetime import json +from unittest import mock -import mock import pytest # type: ignore from google.auth import _jwt_async as jwt_async diff --git a/tests_async/transport/test_aiohttp_requests.py b/tests_async/transport/test_aiohttp_requests.py index d00955a7d..550a37a9b 100644 --- a/tests_async/transport/test_aiohttp_requests.py +++ b/tests_async/transport/test_aiohttp_requests.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock + import aiohttp # type: ignore from aioresponses import aioresponses, core # type: ignore -import mock import pytest # type: ignore from tests_async.transport import async_compliance