Skip to content

Commit 4db4bbf

Browse files
committed
Switch to unittest.mock from mock
Now that the minimum supported version of Python is 3.7, we can stop using the external mock requirement, and import it from unittest. I have also attempted to keep imports ordered. Fixes #377
1 parent 84bf637 commit 4db4bbf

25 files changed

+32
-30
lines changed

noxfile.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ def default(session, install_grpc=True, prerelease=False, install_async_rest=Fal
124124

125125
session.install(
126126
"dataclasses",
127-
"mock",
128127
"pytest",
129128
"pytest-cov",
130129
"pytest-xdist",
@@ -280,7 +279,6 @@ def mypy(session):
280279
"types-setuptools",
281280
"types-requests",
282281
"types-protobuf",
283-
"types-mock",
284282
"types-dataclasses",
285283
)
286284
session.run("mypy", "google", "tests")

tests/asyncio/future/test_async_future.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# limitations under the License.
1414

1515
import asyncio
16+
from unittest import mock
1617

17-
import mock
1818
import pytest
1919

2020
from google.api_core import exceptions

tests/asyncio/gapic/test_method_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# limitations under the License.
1414

1515
import datetime
16+
from unittest import mock
1617

17-
import mock
1818
import pytest
1919

2020
try:

tests/asyncio/operations_v1/test_operations_async_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import mock
15+
from unittest import mock
16+
1617
import pytest
1718

1819
try:

tests/asyncio/retry/test_retry_streaming_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import asyncio
1516
import datetime
1617
import re
17-
import asyncio
18+
from unittest import mock
1819

19-
import mock
2020
import pytest
2121

2222
from google.api_core import exceptions

tests/asyncio/retry/test_retry_unary_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
import datetime
1616
import re
17+
from unittest import mock
1718

18-
import mock
1919
import pytest
2020

2121
from google.api_core import exceptions

tests/asyncio/test_grpc_helpers_async.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import mock
15+
from unittest import mock
16+
1617
import pytest # noqa: I202
1718

1819
try:

tests/asyncio/test_operation_async.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
# limitations under the License.
1414

1515

16-
import mock
16+
from unittest import mock
17+
1718
import pytest
1819

1920
try:

tests/asyncio/test_page_iterator_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# limitations under the License.
1414

1515
import inspect
16+
from unittest import mock
1617

17-
import mock
1818
import pytest
1919

2020
from google.api_core import page_iterator_async

tests/asyncio/test_rest_streaming_async.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
# TODO: set random.seed explicitly in each test function.
1616
# See related issue: https://github.com/googleapis/python-api-core/issues/689.
1717

18-
import pytest # noqa: I202
19-
import mock
20-
2118
import datetime
2219
import logging
2320
import random
2421
import time
2522
from typing import List, AsyncIterator
23+
from unittest import mock
24+
25+
import pytest # noqa: I202
2626

2727
import proto
2828

0 commit comments

Comments
 (0)