Skip to content

Instantly share code, notes, and snippets.

View e-kondr01's full-sized avatar

Egor Kondrashov e-kondr01

  • ITMO
View GitHub Profile
@e-kondr01
e-kondr01 / README.md
Last active July 8, 2024 22:25
Pytest + FastAPI + Async SQLAlchemy

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).