Skip to content

Commit 85789ee

Browse files
committed
refactor: httpx transport warning fixed
1 parent 7e34800 commit 85789ee

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

db/create.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
-- DROP DATABASE IF EXISTS devdb;
2+
-- CREATE DATABASE devdb;
13
\connect devdb;
24
CREATE SCHEMA shakespeare;
35
CREATE SCHEMA happy_hog;

tests/conftest.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
from httpx import AsyncClient
2+
from httpx import AsyncClient, ASGITransport
33

44
from app.database import engine
55
from app.main import app
@@ -29,10 +29,16 @@ async def start_db():
2929

3030
@pytest.fixture(scope="session")
3131
async def client(start_db) -> AsyncClient:
32-
async with AsyncClient(
32+
33+
transport = ASGITransport(
3334
app=app,
35+
36+
)
37+
async with AsyncClient(
38+
# app=app,
3439
base_url="http://testserver/v1",
3540
headers={"Content-Type": "application/json"},
41+
transport=transport,
3642
) as test_client:
3743
app.state.redis = await get_redis()
3844
yield test_client

0 commit comments

Comments
 (0)