Skip to content

Commit 1aa5bb7

Browse files
committed
support AsyncMock on 3.7
1 parent 31c4346 commit 1aa5bb7

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

tests/transport/aio/test_aiohttp.py

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

1515
import asyncio
16-
from unittest.mock import AsyncMock, Mock, patch
16+
from unittest.mock import Mock, patch
17+
try:
18+
from unittest.mock import AsyncMock
19+
except ImportError:
20+
# Fallback for Python < 3.8
21+
from mock import AsyncMock
1722

1823
from aioresponses import aioresponses # type: ignore
1924
import pytest # type: ignore

tests_async/oauth2/test_reauth_async.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414

1515
import copy
1616
from unittest import mock
17+
try:
18+
from unittest.mock import AsyncMock
19+
except ImportError:
20+
# Fallback for Python < 3.8
21+
from mock import AsyncMock
1722

1823
import pytest # type: ignore
1924

@@ -22,7 +27,7 @@
2227
from google.oauth2 import reauth
2328

2429

25-
MOCK_REQUEST = mock.AsyncMock(spec=["transport.Request"])
30+
MOCK_REQUEST = AsyncMock(spec=["transport.Request"])
2631
CHALLENGES_RESPONSE_TEMPLATE = {
2732
"status": "CHALLENGE_REQUIRED",
2833
"sessionId": "123",

0 commit comments

Comments
 (0)