Skip to content

Commit

Permalink
Fixes pytest-asyncio warning for event_loop (#1760)
Browse files Browse the repository at this point in the history
  • Loading branch information
waketzheng authored Nov 9, 2024
1 parent aee6e5c commit 9e392e4
Show file tree
Hide file tree
Showing 3 changed files with 568 additions and 518 deletions.
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

0 comments on commit 9e392e4

Please sign in to comment.