Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update deprecated pytest async features #300

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions server/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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()

Expand Down