Files
romm/backend/tests/adapters/services/conftest.py
Michael Manganiello ba21cbc1e1 misc: Separate tests folder from backend code
Create separate `tests/` folder for all tests. This will also simplify
not copying tests code into the Docker image.
2025-08-08 12:49:13 -03:00

19 lines
466 B
Python

from contextvars import ContextVar
import aiohttp
import pytest_asyncio
@pytest_asyncio.fixture
async def mock_ctx_aiohttp_session():
"""Create a real aiohttp session for integration tests."""
session = aiohttp.ClientSession()
ctx_aiohttp_session: ContextVar[aiohttp.ClientSession] = ContextVar(
"aiohttp_session"
)
ctx_aiohttp_session.set(session)
try:
yield ctx_aiohttp_session
finally:
await session.close()