Skip to main content

Database testing toolkit integrating Postgres, SQLAlchemy, Pytest and Docker

Project description

[!WARNING]
Alpha-level software.

Elefast 🐘⚡

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

# tests/test_something_with_the_database.py
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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elefast-0.1.0a1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elefast-0.1.0a1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file elefast-0.1.0a1.tar.gz.

File metadata

  • Download URL: elefast-0.1.0a1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for elefast-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 9afa03b6f1c3c120aa211d19d5b983d00028c6a8ae3b20783d22152ac1894e48
MD5 e2a1a6c4fdd502604cc3a9dc9710fb0a
BLAKE2b-256 0d9eb298fcce9a94e3b25918abe6ea0c751beca15cfbc8c71490323a6d5c167a

See more details on using hashes here.

File details

Details for the file elefast-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: elefast-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for elefast-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 634cc4fe0903e1d75e2584879e843e6ef5e488fc493ebba5255f062899eb727a
MD5 32abe43a0367568641af2c1c6fa25253
BLAKE2b-256 606522227533b63b7f53d92da04a6b1197bf156016490f4bae3b0bd431352b78

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page