fix: add root tests/conftest.py with session-scoped event_loop
This commit is contained in:
parent
94978ccdf1
commit
54f7a2bdd6
22
tests/conftest.py
Normal file
22
tests/conftest.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
"""
|
||||||
|
Root conftest for all tests.
|
||||||
|
|
||||||
|
Configures pytest-asyncio to use session-scoped event loop.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="session")
|
||||||
|
def event_loop():
|
||||||
|
"""
|
||||||
|
Create session-scoped event loop.
|
||||||
|
|
||||||
|
This ensures all async fixtures use the SAME event loop
|
||||||
|
across all test files in the session.
|
||||||
|
"""
|
||||||
|
loop = asyncio.get_event_loop_policy().new_event_loop()
|
||||||
|
yield loop
|
||||||
|
loop.close()
|
||||||
@ -37,14 +37,6 @@ def require_credentials(kwork_credentials):
|
|||||||
return kwork_credentials
|
return kwork_credentials
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
|
||||||
def event_loop():
|
|
||||||
"""Create session-scoped event loop for all E2E tests."""
|
|
||||||
loop = asyncio.get_event_loop_policy().new_event_loop()
|
|
||||||
yield loop
|
|
||||||
loop.close()
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
async def e2e_client(require_credentials):
|
async def e2e_client(require_credentials):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user