Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 42d331d

Browse files
committed
simplified imports
1 parent eaef0fb commit 42d331d

8 files changed

Lines changed: 17 additions & 34 deletions

File tree

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@
7676
# TODO(https://github.com/googleapis/google-auth-library-python/issues/1722): `test_aiohttp_requests` depend on
7777
# aiohttp < 3.10.0 which is a bug. Investigate and remove the pinned aiohttp version.
7878
"aiohttp < 3.10.0",
79-
"mock; python_version < '3.8'",
80-
"asyncmock; python_version < '3.8'",
79+
"mock >= 4.0.0; python_version < '3.8'",
8180
"freezegun",
8281
]
8382

tests/test__exponential_backoff.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@
1818
from unittest.mock import AsyncMock
1919
else:
2020
import mock
21-
22-
try:
23-
from mock import AsyncMock
24-
except ImportError:
25-
from asyncmock import AsyncMock
21+
from mock import AsyncMock
2622

2723
import pytest # type: ignore
2824

tests/transport/aio/test_aiohttp.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
# limitations under the License.
1414

1515
import asyncio
16-
from unittest.mock import Mock, patch
17-
try:
18-
from unittest.mock import AsyncMock
19-
except ImportError:
20-
# Fallback for Python < 3.8
16+
import sys
17+
if sys.version_info >= (3, 8):
18+
from unittest.mock import Mock, patch, AsyncMock
19+
else:
20+
from unittest.mock import Mock, patch
2121
from mock import AsyncMock
22+
2223
from aioresponses import aioresponses # type: ignore
2324
import pytest # type: ignore
2425
import pytest_asyncio # type: ignore

tests_async/oauth2/test__client_async.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@
2323
from unittest.mock import AsyncMock
2424
else:
2525
import mock
26-
27-
try:
28-
from mock import AsyncMock
29-
except ImportError:
30-
from asyncmock import AsyncMock
26+
from mock import AsyncMock
3127

3228
import freezegun
3329
import pytest # type: ignore

tests_async/oauth2/test_credentials_async.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222
from unittest.mock import AsyncMock
2323
else:
2424
import mock
25-
try:
26-
from mock import AsyncMock
27-
except ImportError:
28-
from asyncmock import AsyncMock
25+
from mock import AsyncMock
2926

3027
import pytest # type: ignore
3128

tests_async/oauth2/test_reauth_async.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
# limitations under the License.
1414

1515
import copy
16-
from unittest import mock
17-
try:
16+
import sys
17+
if sys.version_info >= (3, 8):
18+
from unittest import mock
1819
from unittest.mock import AsyncMock
19-
except ImportError:
20-
# Fallback for Python < 3.8
20+
else:
21+
import mock
2122
from mock import AsyncMock
2223

2324
import pytest # type: ignore

tests_async/oauth2/test_service_account_async.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
from unittest.mock import AsyncMock
2020
else:
2121
import mock
22-
try:
23-
from mock import AsyncMock
24-
except ImportError:
25-
from asyncmock import AsyncMock
22+
from mock import AsyncMock
2623

2724
import pytest # type: ignore
2825

tests_async/transport/test_aiohttp_requests.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@
1818
from unittest.mock import AsyncMock
1919
else:
2020
import mock
21-
22-
try:
23-
from mock import AsyncMock
24-
except ImportError:
25-
from asyncmock import AsyncMock
21+
from mock import AsyncMock
2622

2723
import aiohttp # type: ignore
2824
from aioresponses import aioresponses, core # type: ignore

0 commit comments

Comments
 (0)