File tree 4 files changed +17
-8
lines changed
fastapi-redis/fastapiredis
4 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 3
3
from unittest import mock
4
4
5
5
import pytest
6
- from httpx import AsyncClient
6
+ from httpx import ASGITransport , AsyncClient
7
7
8
8
from .application import app , container
9
9
from .services import Service
10
10
11
11
12
12
@pytest .fixture
13
13
def client (event_loop ):
14
- client = AsyncClient (app = app , base_url = "http://test" )
14
+ client = AsyncClient (
15
+ transport = ASGITransport (app = app ),
16
+ base_url = "http://test" ,
17
+ )
15
18
yield client
16
19
event_loop .run_until_complete (client .aclose ())
17
20
Original file line number Diff line number Diff line change 1
1
from unittest import mock
2
2
3
3
import pytest
4
- from httpx import AsyncClient
4
+ from httpx import ASGITransport , AsyncClient
5
5
6
6
from fastapi_di_example import app , container , Service
7
7
8
8
9
9
@pytest .fixture
10
10
async def client (event_loop ):
11
- async with AsyncClient (app = app , base_url = "http://test" ) as client :
11
+ async with AsyncClient (
12
+ transport = ASGITransport (app = app ),
13
+ base_url = "http://test" ,
14
+ ) as client :
12
15
yield client
13
16
14
17
Original file line number Diff line number Diff line change 3
3
from unittest import mock
4
4
5
5
import pytest
6
- from httpx import AsyncClient
6
+ from httpx import ASGITransport , AsyncClient
7
7
8
8
from giphynavigator .application import app
9
9
from giphynavigator .giphy import GiphyClient
10
10
11
11
12
12
@pytest .fixture
13
13
async def client ():
14
- async with AsyncClient (app = app , base_url = "http://test" ) as client :
14
+ async with AsyncClient (
15
+ transport = ASGITransport (app = app ),
16
+ base_url = "http://test" ,
17
+ ) as client :
15
18
yield client
16
19
17
20
Original file line number Diff line number Diff line change 1
- from httpx import AsyncClient
1
+ from httpx import ASGITransport , AsyncClient
2
2
from pytest import fixture , mark
3
3
from pytest_asyncio import fixture as aio_fixture
4
4
19
19
20
20
@aio_fixture
21
21
async def async_client ():
22
- client = AsyncClient (app = web .app , base_url = "http://test" )
22
+ client = AsyncClient (transport = ASGITransport ( app = web .app ) , base_url = "http://test" )
23
23
yield client
24
24
await client .aclose ()
25
25
You can’t perform that action at this time.
0 commit comments