test: fix test warning (#2725)
This commit is contained in:
parent
a4c000d7dc
commit
a28e334c5f
1 changed files with 5 additions and 3 deletions
|
|
@ -10,7 +10,7 @@ uvloop.install()
|
|||
import pytest
|
||||
import pytest_asyncio
|
||||
from fastapi.testclient import TestClient
|
||||
from httpx import AsyncClient
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
|
||||
from lnbits.app import create_app
|
||||
from lnbits.core.crud import (
|
||||
|
|
@ -56,14 +56,16 @@ async def app():
|
|||
@pytest_asyncio.fixture(scope="session")
|
||||
async def client(app):
|
||||
url = f"http://{settings.host}:{settings.port}"
|
||||
async with AsyncClient(app=app, base_url=url) as client:
|
||||
async with AsyncClient(transport=ASGITransport(app=app), base_url=url) as client:
|
||||
yield client
|
||||
|
||||
|
||||
# function scope
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
async def http_client(app):
|
||||
url = f"http://{settings.host}:{settings.port}"
|
||||
async with AsyncClient(app=app, base_url=url) as client:
|
||||
|
||||
async with AsyncClient(transport=ASGITransport(app=app), base_url=url) as client:
|
||||
yield client
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue