Run API tests with Pytest, FastAPI and Async SQLAlchemy.
Changes made in test functions are not persisted to DB, even if
await session.commit()
is called.
This allows tests to be independent,
able to run in parallel or in a shuffled order without
affecting the result.
This snippet does not include creation of DB tables, as I use Alembic for migration management and advise you to do the same (even in tests).