Skip to content

remove use of old external "mock" module #1786

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def mypy(session):
"types-pyOpenSSL",
"types-requests",
"types-setuptools",
"types-mock",
)
session.run("mypy", "-p", "google", "-p", "tests", "-p", "tests_async")

Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"grpcio",
"flask",
"freezegun",
"mock",
# TODO(https://github.com/googleapis/google-auth-library-python/issues/1736): Remove `oauth2client` from testing requirements once an extra is added for `oauth2client` dependency.
"oauth2client",
*pyjwt_extra_require,
Expand Down
2 changes: 1 addition & 1 deletion system_tests/system_tests_sync/test_external_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
from http.server import HTTPServer
from google.oauth2 import service_account
import pytest
from mock import patch
from unittest.mock import patch

# Populate values from the output of scripts/setup_external_accounts.sh.
_AUDIENCE_OIDC = "//iam.googleapis.com/projects/79992041559/locations/global/workloadIdentityPools/pool-73wslmxn/providers/oidc-73wslmxn"
Expand Down
2 changes: 1 addition & 1 deletion system_tests/system_tests_sync/test_mtls_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
# limitations under the License.

import json
import mock
import os
import time
from os import path
from unittest import mock


import google.auth
Expand Down
2 changes: 1 addition & 1 deletion tests/compute_engine/test__metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/compute_engine/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import os
import sys
from unittest import mock

import mock
import pytest # type: ignore


Expand Down
2 changes: 1 addition & 1 deletion tests/crypt/test__python_rsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/test__client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import json
import os
import urllib
from unittest import mock

import mock
import pytest # type: ignore

from google.auth import _helpers
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/test_challenges.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import base64
import os
import sys
from unitest import mock

import mock
import pytest # type: ignore
import pyu2f # type: ignore

Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/test_gdch_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import datetime
import json
import os
from unittest import mock

import mock
import pytest # type: ignore
import requests

Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/test_id_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import json
import os
from unittest import mock

import mock
import pytest # type: ignore

from google.auth import environment_vars
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/test_reauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/test_service_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/test_sts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import http.client as http_client
import json
import urllib
from unittest import mock

import mock
import pytest # type: ignore

from google.auth import exceptions
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/test_webauthn_handler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import struct
from unittest import mock

import mock
import pytest # type: ignore

from google.auth import exceptions
Expand Down
3 changes: 2 additions & 1 deletion tests/oauth2/test_webauthn_handler_factory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import mock
from unittest import mock

import pytest # type: ignore

from google.oauth2 import webauthn_handler
Expand Down
2 changes: 1 addition & 1 deletion tests/test__cloud_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test__default.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import json
import os
from unittest import mock

import mock
import pytest # type: ignore

from google.auth import _default
Expand Down
3 changes: 2 additions & 1 deletion tests/test__exponential_backoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 _exponential_backoff
Expand Down
2 changes: 1 addition & 1 deletion tests/test__oauth2client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import importlib
import os
import sys
from unittest import mock

import mock
import pytest # type: ignore

try:
Expand Down
2 changes: 1 addition & 1 deletion tests/test__refresh_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import random
import threading
import time
from unittest import mock

import mock
import pytest # type: ignore

from google.auth import _refresh_worker, credentials, exceptions
Expand Down
2 changes: 1 addition & 1 deletion tests/test_app_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import json
import os
import urllib.parse
from unittest import mock

import mock
import pytest # type: ignore

from google.auth import _helpers, external_account
Expand Down
2 changes: 1 addition & 1 deletion tests/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_downscoped.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import http.client as http_client
import json
import urllib
from unittest import mock

import mock
import pytest # type: ignore

from google.auth import _helpers
Expand Down
2 changes: 1 addition & 1 deletion tests/test_external_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import http.client as http_client
import json
import urllib
from unittest import mock

import mock
import pytest # type: ignore

from google.auth import _helpers
Expand Down
2 changes: 1 addition & 1 deletion tests/test_external_account_authorized_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_identity_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import json
import os
import urllib
from unittest import mock

import mock
from OpenSSL import crypto
import pytest # type: ignore

Expand Down
2 changes: 1 addition & 1 deletion tests/test_impersonated_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions tests/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
# limitations under the License.

import platform

import mock
from unittest import mock

from google.auth import metrics
from google.auth import version
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pluggable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/transport/aio/test_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# limitations under the License.

import asyncio
from unittest.mock import AsyncMock, Mock, patch

from aioresponses import aioresponses # type: ignore
from mock import AsyncMock, Mock, patch
import pytest # type: ignore
import pytest_asyncio # type: ignore

Expand Down
2 changes: 1 addition & 1 deletion tests/transport/aio/test_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

import asyncio
from typing import AsyncGenerator
from unittest.mock import Mock, patch

from aioresponses import aioresponses # type: ignore
from mock import Mock, patch
import pytest # type: ignore

from google.auth.aio.credentials import AnonymousCredentials
Expand Down
2 changes: 1 addition & 1 deletion tests/transport/test__custom_tls_signer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,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
Expand Down
2 changes: 1 addition & 1 deletion tests/transport/test__mtls_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import os
import re
from unittes import mock

import mock
from OpenSSL import crypto
import pytest # type: ignore

Expand Down
2 changes: 1 addition & 1 deletion tests/transport/test_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading