Function-scoped fixture with transaction rollback for postgres tests. Equivalent to: test.TestCase with standard testmodels.
(db_module_postgres)
| 41 | |
| 42 | @pytest_asyncio.fixture(scope="function") |
| 43 | async def db_postgres(db_module_postgres): |
| 44 | """ |
| 45 | Function-scoped fixture with transaction rollback for postgres tests. |
| 46 | |
| 47 | Equivalent to: test.TestCase with standard testmodels. |
| 48 | """ |
| 49 | conn = db_module_postgres.db() |
| 50 | transaction = conn._in_transaction() |
| 51 | await transaction.__aenter__() |
| 52 | |
| 53 | try: |
| 54 | yield db_module_postgres |
| 55 | finally: |
| 56 | |
| 57 | class _RollbackException(Exception): |
| 58 | pass |
| 59 | |
| 60 | await transaction.__aexit__(_RollbackException, _RollbackException(), None) |
| 61 | |
| 62 | |
| 63 | @pytest_asyncio.fixture(scope="function") |
nothing calls this directly
no test coverage detected
searching dependent graphs…