File tree Expand file tree Collapse file tree 4 files changed +17
-8
lines changed
fastapi-redis/fastapiredis Expand file tree Collapse file tree 4 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 33from unittest import mock
44
55import pytest
6- from httpx import AsyncClient
6+ from httpx import ASGITransport , AsyncClient
77
88from .application import app , container
99from .services import Service
1010
1111
1212@pytest .fixture
1313def 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+ )
1518 yield client
1619 event_loop .run_until_complete (client .aclose ())
1720
Original file line number Diff line number Diff line change 11from unittest import mock
22
33import pytest
4- from httpx import AsyncClient
4+ from httpx import ASGITransport , AsyncClient
55
66from fastapi_di_example import app , container , Service
77
88
99@pytest .fixture
1010async 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 :
1215 yield client
1316
1417
Original file line number Diff line number Diff line change 33from unittest import mock
44
55import pytest
6- from httpx import AsyncClient
6+ from httpx import ASGITransport , AsyncClient
77
88from giphynavigator .application import app
99from giphynavigator .giphy import GiphyClient
1010
1111
1212@pytest .fixture
1313async 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 :
1518 yield client
1619
1720
Original file line number Diff line number Diff line change 1- from httpx import AsyncClient
1+ from httpx import ASGITransport , AsyncClient
22from pytest import fixture , mark
33from pytest_asyncio import fixture as aio_fixture
44
1919
2020@aio_fixture
2121async 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" )
2323 yield client
2424 await client .aclose ()
2525
You can’t perform that action at this time.
0 commit comments