Create a new database session with a rollback at the end of the test.
(mock_session_env, mock_azure_credential)
| 359 | |
| 360 | @pytest_asyncio.fixture(scope="function") |
| 361 | async def db_session(mock_session_env, mock_azure_credential): |
| 362 | """Create a new database session with a rollback at the end of the test.""" |
| 363 | engine = await create_postgres_engine_from_env() |
| 364 | async_sesion = async_sessionmaker(autocommit=False, autoflush=False, bind=engine) |
| 365 | session = async_sesion() |
| 366 | await session.begin() |
| 367 | yield session |
| 368 | await session.rollback() |
| 369 | await session.close() |
| 370 | await engine.dispose() |
| 371 | |
| 372 | |
| 373 | @pytest_asyncio.fixture(scope="function") |
nothing calls this directly
no test coverage detected