Skip to content

Commit 8cec99d

Browse files
committed
Fix compatibility with httpx v0.27.0
1 parent 160b089 commit 8cec99d

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

examples/miniapps/fastapi-redis/fastapiredis/tests.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
from unittest import mock
44

55
import pytest
6-
from httpx import AsyncClient
6+
from httpx import ASGITransport, AsyncClient
77

88
from .application import app, container
99
from .services import Service
1010

1111

1212
@pytest.fixture
1313
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+
)
1518
yield client
1619
event_loop.run_until_complete(client.aclose())
1720

examples/miniapps/fastapi-simple/tests.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
from unittest import mock
22

33
import pytest
4-
from httpx import AsyncClient
4+
from httpx import ASGITransport, AsyncClient
55

66
from fastapi_di_example import app, container, Service
77

88

99
@pytest.fixture
1010
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:
1215
yield client
1316

1417

examples/miniapps/fastapi/giphynavigator/tests.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
from unittest import mock
44

55
import pytest
6-
from httpx import AsyncClient
6+
from httpx import ASGITransport, AsyncClient
77

88
from giphynavigator.application import app
99
from giphynavigator.giphy import GiphyClient
1010

1111

1212
@pytest.fixture
1313
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:
1518
yield client
1619

1720

tests/unit/wiring/test_fastapi_py36.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from httpx import AsyncClient
1+
from httpx import ASGITransport, AsyncClient
22
from pytest import fixture, mark
33
from pytest_asyncio import fixture as aio_fixture
44

@@ -19,7 +19,7 @@
1919

2020
@aio_fixture
2121
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")
2323
yield client
2424
await client.aclose()
2525

0 commit comments

Comments
 (0)