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

Fixes pytest-asyncio warning for event_loop fixture #1760

Merged
merged 1 commit into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
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 examples/blacksheep/_tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# mypy: no-disallow-untyped-decorators
# pylint: disable=E0611,E0401
import asyncio

import pytest
import pytest_asyncio
from blacksheep import JSONContent
Expand All @@ -10,19 +8,12 @@
from server import app


@pytest_asyncio.fixture(scope="session")
@pytest_asyncio.fixture(scope="session", loop_scope="session")
async def client(api):
return TestClient(api)


@pytest.fixture(scope="session")
def event_loop(request):
loop = asyncio.get_event_loop_policy().new_event_loop()
yield loop
loop.close()


@pytest_asyncio.fixture(scope="session")
@pytest_asyncio.fixture(scope="session", loop_scope="session")
async def api():
await app.start()
yield app
Expand Down
Loading