Using an actual database for testing is nice, but setting everything up can be a pain. Generating the schema, isolating the state, and supporting parallel execution while keeping everything reasonably quick. Elefast helps you by providing utilities for all of these tasks
To learn more, visit the documentation or run through the quickstart guide below.
Install the package from PyPi through your package manager
uv add 'elefast[docker]'add the recommended set of fixtures to your conftest.py
mkdir tests/ && uv run elefast init >> tests/conftest.pycreate a test using your new set of fixtures
from sqlalchemy import Connection, text
def test_database_math(db_connection: Connection):
result = db_connection.execute(text("SELECT 1 + 1")).scalar_one()
assert result == 2When you now run pytest, we'll automatically start a Docker container (if one is not already running), and pass a database connection into the test