From 3077adb21bafc9f15628279df80e99566e21b097 Mon Sep 17 00:00:00 2001 From: James Stevenson Date: Mon, 5 Aug 2024 14:08:01 -0400 Subject: [PATCH] fix: update deprecated pytest async features --- server/tests/conftest.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/server/tests/conftest.py b/server/tests/conftest.py index da8a95e8..0a6275a9 100644 --- a/server/tests/conftest.py +++ b/server/tests/conftest.py @@ -1,19 +1,10 @@ """Provide core fixtures for testing Flask functions.""" -import asyncio from collections.abc import Callable import pytest from curfu.main import app, get_domain_services, get_gene_services, start_fusor -from httpx import AsyncClient - - -@pytest.fixture(scope="session") -def event_loop(request): - """Create an instance of the default event loop for each test case.""" - loop = asyncio.get_event_loop_policy().new_event_loop() - yield loop - loop.close() +from httpx import ASGITransport, AsyncClient @pytest.fixture(scope="session") @@ -22,7 +13,7 @@ async def async_client(): app.state.fusor = await start_fusor() app.state.genes = get_gene_services() app.state.domains = get_domain_services() - client = AsyncClient(app=app, base_url="http://test") + client = AsyncClient(transport=ASGITransport(app=app), base_url="http://test") yield client await client.aclose()