Skip to content

Commit 1eb3085

Browse files
bump httpx test dependency (#630)
* bump httpx test dependency * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 33abffb commit 1eb3085

14 files changed

+71
-33
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ test = [
4949
"mypy ==1.13.0",
5050
"ruff ==0.7.1",
5151
"black ==24.10.0",
52-
"httpx >=0.23.3, <0.28.0",
52+
"httpx >=0.23.3, <0.29.0",
5353
"SQLAlchemy-Utils >=0.40.0, <0.42.0",
5454
"sqlmodel >=0.0.11, <0.1.0",
5555
"arrow >=1.2.3, <1.4.0",

tests/mongoengine/test_auth.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import mongoengine as me
44
import pytest
55
import pytest_asyncio
6-
from httpx import AsyncClient
6+
from httpx import ASGITransport, AsyncClient
77
from mongoengine import connect, disconnect
88
from starlette.applications import Starlette
99
from starlette.requests import Request
@@ -45,7 +45,9 @@ async def client(self):
4545
app = Starlette()
4646
admin.add_view(PostView(Post))
4747
admin.mount_to(app)
48-
async with AsyncClient(app=app, base_url="http://testserver") as c:
48+
async with AsyncClient(
49+
transport=ASGITransport(app=app), base_url="http://testserver"
50+
) as c:
4951
yield c
5052

5153
@pytest.mark.asyncio

tests/odmantic/test_async_engine.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import pytest
66
import pytest_asyncio
7-
from httpx import AsyncClient
7+
from httpx import ASGITransport, AsyncClient
88
from odmantic import AIOEngine, EmbeddedModel, Field, Model
99
from requests import Request
1010
from starlette.applications import Starlette
@@ -93,7 +93,9 @@ async def client(prepare_database, aio_engine: AIOEngine):
9393
app = Starlette()
9494
admin.add_view(UserView(User))
9595
admin.mount_to(app)
96-
async with AsyncClient(app=app, base_url="http://testserver") as c:
96+
async with AsyncClient(
97+
transport=ASGITransport(app=app), base_url="http://testserver"
98+
) as c:
9799
yield c
98100

99101

tests/odmantic/test_auth.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44
import pytest_asyncio
5-
from httpx import AsyncClient
5+
from httpx import ASGITransport, AsyncClient
66
from odmantic import Field, Model, SyncEngine
77
from starlette.applications import Starlette
88
from starlette.requests import Request
@@ -36,7 +36,9 @@ async def client(self, sync_engine: SyncEngine):
3636
app = Starlette()
3737
admin.add_view(PostView(Post))
3838
admin.mount_to(app)
39-
async with AsyncClient(app=app, base_url="http://testserver") as c:
39+
async with AsyncClient(
40+
transport=ASGITransport(app=app), base_url="http://testserver"
41+
) as c:
4042
yield c
4143
sync_engine.remove(Post)
4244

tests/odmantic/test_sync_engine.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44
import pytest_asyncio
5-
from httpx import AsyncClient
5+
from httpx import ASGITransport, AsyncClient
66
from odmantic import Model, Reference, SyncEngine
77
from starlette.applications import Starlette
88
from starlette_admin.contrib.odmantic import Admin, ModelView
@@ -48,7 +48,9 @@ async def client(prepare_database, sync_engine: SyncEngine):
4848
admin.add_view(ModelView(Author))
4949
admin.add_view(ModelView(Quote))
5050
admin.mount_to(app)
51-
async with AsyncClient(app=app, base_url="http://testserver") as c:
51+
async with AsyncClient(
52+
transport=ASGITransport(app=app), base_url="http://testserver"
53+
) as c:
5254
yield c
5355

5456

tests/sqla/test_async_engine.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44
import pytest_asyncio
5-
from httpx import AsyncClient
5+
from httpx import ASGITransport, AsyncClient
66
from sqlalchemy import Column, Integer, String, select
77
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession
88
from sqlalchemy.orm import declarative_base
@@ -78,7 +78,9 @@ async def client(engine: AsyncEngine):
7878
admin.add_view(ProductView(Product))
7979
app = Starlette()
8080
admin.mount_to(app)
81-
async with AsyncClient(app=app, base_url="http://testserver") as c:
81+
async with AsyncClient(
82+
transport=ASGITransport(app=app), base_url="http://testserver"
83+
) as c:
8284
yield c
8385

8486

tests/sqla/test_auth.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44
import pytest_asyncio
5-
from httpx import AsyncClient
5+
from httpx import ASGITransport, AsyncClient
66
from sqlalchemy import Column, Integer, String
77
from sqlalchemy.engine import Engine
88
from sqlalchemy.orm import Session, declarative_base
@@ -58,7 +58,9 @@ async def client(self, engine):
5858
app = Starlette()
5959
admin.add_view(PostView(Post))
6060
admin.mount_to(app)
61-
async with AsyncClient(app=app, base_url="http://testserver") as c:
61+
async with AsyncClient(
62+
transport=ASGITransport(app=app), base_url="http://testserver"
63+
) as c:
6264
yield c
6365

6466
@pytest.mark.asyncio

tests/sqla/test_multiple_pks.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22
import pytest_asyncio
3-
from httpx import AsyncClient
3+
from httpx import ASGITransport, AsyncClient
44
from sqlalchemy import (
55
Boolean,
66
Column,
@@ -65,7 +65,9 @@ def app(admin: Admin):
6565

6666
@pytest_asyncio.fixture
6767
async def client(app):
68-
async with AsyncClient(app=app, base_url="http://testserver") as c:
68+
async with AsyncClient(
69+
transport=ASGITransport(app=app), base_url="http://testserver"
70+
) as c:
6971
yield c
7072

7173

tests/sqla/test_sqla_and_pydantic.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55
import pytest_asyncio
6-
from httpx import AsyncClient
6+
from httpx import ASGITransport, AsyncClient
77
from pydantic import BaseModel, Field
88
from sqlalchemy import (
99
Boolean,
@@ -99,7 +99,9 @@ def app(admin: Admin):
9999

100100
@pytest_asyncio.fixture
101101
async def client(app):
102-
async with AsyncClient(app=app, base_url="http://testserver") as c:
102+
async with AsyncClient(
103+
transport=ASGITransport(app=app), base_url="http://testserver"
104+
) as c:
103105
yield c
104106

105107

tests/sqla/test_sqla_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import pytest
1212
import pytest_asyncio
1313
from colour import Color
14-
from httpx import AsyncClient
14+
from httpx import ASGITransport, AsyncClient
1515
from sqlalchemy import Column, Integer, MetaData, event, select
1616
from sqlalchemy.engine import Engine
1717
from sqlalchemy.orm import Session, declarative_base
@@ -126,7 +126,9 @@ async def client(engine: Engine):
126126
admin.add_view(ModelView(Model))
127127
app = Starlette()
128128
admin.mount_to(app)
129-
async with AsyncClient(app=app, base_url="http://testserver") as c:
129+
async with AsyncClient(
130+
transport=ASGITransport(app=app), base_url="http://testserver"
131+
) as c:
130132
yield c
131133

132134

0 commit comments

Comments
 (0)