File tree Expand file tree Collapse file tree 3 files changed +40
-5
lines changed
Expand file tree Collapse file tree 3 files changed +40
-5
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ verify_ssl = true
55
66[dev-packages ]
77async-asgi-testclient = " *"
8+ async_generator = " *"
9+ asyncmock = " *"
810bandit = " *"
911black = " ==19.10b0"
1012coveralls = " *"
Original file line number Diff line number Diff line change 55"""
66import datetime
77import os
8- from contextlib import asynccontextmanager
9- from unittest import mock
8+
9+ try :
10+ from unittest .mock import AsyncMock
11+ except ImportError :
12+ # Python 3.7 backwards compat
13+ from asyncmock import AsyncMock
14+
15+ try :
16+ from contextlib import asynccontextmanager
17+ except ImportError :
18+ # Python 3.6 backwards compat
19+ from async_generator import asynccontextmanager
1020
1121import pytest
1222from async_asgi_testclient import TestClient as AsyncTestClient
@@ -80,7 +90,7 @@ def mock_client_session_class(request):
8090 See: https://docs.pytest.org/en/5.4.1/unittest.html#mixing-pytest-fixtures-into-unittest-testcase-subclasses-using-marks
8191 """
8292
83- httputils .CLIENT_SESSION = request .cls .mock_client_session = mock . AsyncMock ()
93+ httputils .CLIENT_SESSION = request .cls .mock_client_session = AsyncMock ()
8494 httputils .CLIENT_SESSION .get = mocked_session_get
8595 try :
8696 yield
@@ -94,7 +104,7 @@ async def mock_client_session():
94104 instance.
95105 """
96106
97- httputils .CLIENT_SESSION = mock . AsyncMock ()
107+ httputils .CLIENT_SESSION = AsyncMock ()
98108 httputils .CLIENT_SESSION .get = mocked_session_get
99109 try :
100110 yield httputils .CLIENT_SESSION
You can’t perform that action at this time.
0 commit comments