Skip to content

Repository files navigation

Elefast 🐘⚡

current package version PyPI - Downloads supported Python versions github sponsors license

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.

Quickstart

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

create 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 == 2

When 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

About

🐘 Database testing toolkit integrating Postgres, SQLAlchemy, Pytest and Docker

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages