From b1ea7faf48e281ff77e48ebea4af4e8f3de3e819 Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Sat, 6 Jul 2024 23:49:43 +0200 Subject: [PATCH] chore: remove use of old external mock --- google/api_core/exceptions.py | 3 --- google/api_core/path_template.py | 2 -- google/api_core/timeout.py | 2 -- noxfile.py | 3 --- tests/asyncio/future/test_async_future.py | 2 +- tests/asyncio/gapic/test_method_async.py | 2 +- tests/asyncio/operations_v1/test_operations_async_client.py | 3 ++- tests/asyncio/retry/test_retry_streaming_async.py | 2 +- tests/asyncio/retry/test_retry_unary_async.py | 2 +- tests/asyncio/test_grpc_helpers_async.py | 3 ++- tests/asyncio/test_operation_async.py | 2 +- tests/asyncio/test_page_iterator_async.py | 2 +- tests/unit/future/test__helpers.py | 2 +- tests/unit/future/test_polling.py | 2 +- tests/unit/gapic/test_method.py | 2 +- tests/unit/operations_v1/test_operations_rest_client.py | 2 +- tests/unit/retry/test_retry_base.py | 2 +- tests/unit/retry/test_retry_streaming.py | 2 +- tests/unit/retry/test_retry_unary.py | 2 +- tests/unit/test_bidi.py | 2 +- tests/unit/test_exceptions.py | 2 +- tests/unit/test_extended_operation.py | 2 +- tests/unit/test_grpc_helpers.py | 3 ++- tests/unit/test_operation.py | 2 +- tests/unit/test_page_iterator.py | 2 +- tests/unit/test_path_template.py | 3 +-- tests/unit/test_timeout.py | 3 +-- 27 files changed, 26 insertions(+), 35 deletions(-) diff --git a/google/api_core/exceptions.py b/google/api_core/exceptions.py index d4cb99733..988cdd6d9 100644 --- a/google/api_core/exceptions.py +++ b/google/api_core/exceptions.py @@ -18,9 +18,6 @@ on :mod:`google.api_core`, including both HTTP and gRPC clients. """ -from __future__ import absolute_import -from __future__ import unicode_literals - import http.client from typing import Dict from typing import Union diff --git a/google/api_core/path_template.py b/google/api_core/path_template.py index b8ebb2af9..443d37aee 100644 --- a/google/api_core/path_template.py +++ b/google/api_core/path_template.py @@ -23,8 +23,6 @@ .. _resource names: https://cloud.google.com/apis/design/resource_names """ -from __future__ import unicode_literals - from collections import deque import copy import functools diff --git a/google/api_core/timeout.py b/google/api_core/timeout.py index 868e3e9f4..426a6da41 100644 --- a/google/api_core/timeout.py +++ b/google/api_core/timeout.py @@ -52,8 +52,6 @@ def is_thing_ready(timeout=None): matches ``api_method(request, timeout=None, retry=None)``. """ -from __future__ import unicode_literals - import datetime import functools diff --git a/noxfile.py b/noxfile.py index 593bfc856..688cb3b04 100644 --- a/noxfile.py +++ b/noxfile.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import absolute_import import os import pathlib import re @@ -119,7 +118,6 @@ def default(session, install_grpc=True, prerelease=False): session.install( "dataclasses", - "mock", "pytest", "pytest-cov", "pytest-xdist", @@ -249,7 +247,6 @@ def mypy(session): "types-setuptools", "types-requests", "types-protobuf", - "types-mock", "types-dataclasses", ) session.run("mypy", "google", "tests") diff --git a/tests/asyncio/future/test_async_future.py b/tests/asyncio/future/test_async_future.py index 0cfe67734..659f41cf9 100644 --- a/tests/asyncio/future/test_async_future.py +++ b/tests/asyncio/future/test_async_future.py @@ -13,8 +13,8 @@ # limitations under the License. import asyncio +from unittest import mock -import mock import pytest from google.api_core import exceptions diff --git a/tests/asyncio/gapic/test_method_async.py b/tests/asyncio/gapic/test_method_async.py index ee2069796..4ac2d7bfc 100644 --- a/tests/asyncio/gapic/test_method_async.py +++ b/tests/asyncio/gapic/test_method_async.py @@ -13,8 +13,8 @@ # limitations under the License. import datetime +from unittest import mock -import mock import pytest try: diff --git a/tests/asyncio/operations_v1/test_operations_async_client.py b/tests/asyncio/operations_v1/test_operations_async_client.py index 19ac9b566..e5b20dcd0 100644 --- a/tests/asyncio/operations_v1/test_operations_async_client.py +++ b/tests/asyncio/operations_v1/test_operations_async_client.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 try: diff --git a/tests/asyncio/retry/test_retry_streaming_async.py b/tests/asyncio/retry/test_retry_streaming_async.py index 28ae6ff17..6f2539896 100644 --- a/tests/asyncio/retry/test_retry_streaming_async.py +++ b/tests/asyncio/retry/test_retry_streaming_async.py @@ -15,8 +15,8 @@ import datetime import re import asyncio +from unittest import mock -import mock import pytest from google.api_core import exceptions diff --git a/tests/asyncio/retry/test_retry_unary_async.py b/tests/asyncio/retry/test_retry_unary_async.py index fc2f572b4..032bab756 100644 --- a/tests/asyncio/retry/test_retry_unary_async.py +++ b/tests/asyncio/retry/test_retry_unary_async.py @@ -14,8 +14,8 @@ import datetime import re +from unittest import mock -import mock import pytest from google.api_core import exceptions diff --git a/tests/asyncio/test_grpc_helpers_async.py b/tests/asyncio/test_grpc_helpers_async.py index 1a408ccde..a53de083d 100644 --- a/tests/asyncio/test_grpc_helpers_async.py +++ b/tests/asyncio/test_grpc_helpers_async.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 # noqa: I202 try: diff --git a/tests/asyncio/test_operation_async.py b/tests/asyncio/test_operation_async.py index 127ba6343..f5eb91a9e 100644 --- a/tests/asyncio/test_operation_async.py +++ b/tests/asyncio/test_operation_async.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock -import mock import pytest try: diff --git a/tests/asyncio/test_page_iterator_async.py b/tests/asyncio/test_page_iterator_async.py index 75f9e1cf4..e661bd266 100644 --- a/tests/asyncio/test_page_iterator_async.py +++ b/tests/asyncio/test_page_iterator_async.py @@ -13,8 +13,8 @@ # limitations under the License. import inspect +from unittest import mock -import mock import pytest from google.api_core import page_iterator_async diff --git a/tests/unit/future/test__helpers.py b/tests/unit/future/test__helpers.py index 98afc599f..a37efdd40 100644 --- a/tests/unit/future/test__helpers.py +++ b/tests/unit/future/test__helpers.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.api_core.future import _helpers diff --git a/tests/unit/future/test_polling.py b/tests/unit/future/test_polling.py index f5d9b4f10..2f66f2304 100644 --- a/tests/unit/future/test_polling.py +++ b/tests/unit/future/test_polling.py @@ -15,8 +15,8 @@ import concurrent.futures import threading import time +from unittest import mock -import mock import pytest from google.api_core import exceptions, retry diff --git a/tests/unit/gapic/test_method.py b/tests/unit/gapic/test_method.py index d966f478f..87aa63905 100644 --- a/tests/unit/gapic/test_method.py +++ b/tests/unit/gapic/test_method.py @@ -13,8 +13,8 @@ # limitations under the License. import datetime +from unittest import mock -import mock import pytest try: diff --git a/tests/unit/operations_v1/test_operations_rest_client.py b/tests/unit/operations_v1/test_operations_rest_client.py index 4ab4f1f75..26f34c401 100644 --- a/tests/unit/operations_v1/test_operations_rest_client.py +++ b/tests/unit/operations_v1/test_operations_rest_client.py @@ -14,8 +14,8 @@ # limitations under the License. # import os +from unittest import mock -import mock import pytest try: diff --git a/tests/unit/retry/test_retry_base.py b/tests/unit/retry/test_retry_base.py index a0c6776bf..212c4293b 100644 --- a/tests/unit/retry/test_retry_base.py +++ b/tests/unit/retry/test_retry_base.py @@ -14,8 +14,8 @@ import itertools import re +from unittest import mock -import mock import pytest import requests.exceptions diff --git a/tests/unit/retry/test_retry_streaming.py b/tests/unit/retry/test_retry_streaming.py index 01f35327b..82b60b058 100644 --- a/tests/unit/retry/test_retry_streaming.py +++ b/tests/unit/retry/test_retry_streaming.py @@ -13,8 +13,8 @@ # limitations under the License. import re +from unittest import mock -import mock import pytest from google.api_core import exceptions diff --git a/tests/unit/retry/test_retry_unary.py b/tests/unit/retry/test_retry_unary.py index 7dcd8dd6a..b018fa962 100644 --- a/tests/unit/retry/test_retry_unary.py +++ b/tests/unit/retry/test_retry_unary.py @@ -14,8 +14,8 @@ import datetime import re +from unittest import mock -import mock import pytest from google.api_core import exceptions diff --git a/tests/unit/test_bidi.py b/tests/unit/test_bidi.py index 84ac9dc52..08e80afd0 100644 --- a/tests/unit/test_bidi.py +++ b/tests/unit/test_bidi.py @@ -16,8 +16,8 @@ import logging import queue import threading +from unittest import mock -import mock import pytest try: diff --git a/tests/unit/test_exceptions.py b/tests/unit/test_exceptions.py index 07a368175..e3f8f909a 100644 --- a/tests/unit/test_exceptions.py +++ b/tests/unit/test_exceptions.py @@ -14,8 +14,8 @@ import http.client import json +from unittest import mock -import mock import pytest import requests diff --git a/tests/unit/test_extended_operation.py b/tests/unit/test_extended_operation.py index 53af52047..ab5506624 100644 --- a/tests/unit/test_extended_operation.py +++ b/tests/unit/test_extended_operation.py @@ -15,8 +15,8 @@ import dataclasses import enum import typing +from unittest import mock -import mock import pytest from google.api_core import exceptions diff --git a/tests/unit/test_grpc_helpers.py b/tests/unit/test_grpc_helpers.py index 59442d437..8de9d8c0b 100644 --- a/tests/unit/test_grpc_helpers.py +++ b/tests/unit/test_grpc_helpers.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 try: diff --git a/tests/unit/test_operation.py b/tests/unit/test_operation.py index f029866c6..ee828f9b2 100644 --- a/tests/unit/test_operation.py +++ b/tests/unit/test_operation.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock -import mock import pytest try: diff --git a/tests/unit/test_page_iterator.py b/tests/unit/test_page_iterator.py index cf43aedfb..560722c5d 100644 --- a/tests/unit/test_page_iterator.py +++ b/tests/unit/test_page_iterator.py @@ -14,8 +14,8 @@ import math import types +from unittest import mock -import mock import pytest from google.api_core import page_iterator diff --git a/tests/unit/test_path_template.py b/tests/unit/test_path_template.py index 808b36f34..3694292e9 100644 --- a/tests/unit/test_path_template.py +++ b/tests/unit/test_path_template.py @@ -12,9 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import unicode_literals +from unittest import mock -import mock import pytest from google.api import auth_pb2 diff --git a/tests/unit/test_timeout.py b/tests/unit/test_timeout.py index 0bcf07f07..60a2e65d3 100644 --- a/tests/unit/test_timeout.py +++ b/tests/unit/test_timeout.py @@ -14,8 +14,7 @@ import datetime import itertools - -import mock +from unittest import mock from google.api_core import timeout as timeouts