From a28e334c5f98a2b8eeca68774984b95c75758963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Tue, 1 Oct 2024 11:07:13 +0200 Subject: [PATCH] test: fix test warning (#2725) --- tests/conftest.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 4a9b77de..fc17d9f0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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