Skip to main content

Database testing toolkit integrating Postgres, SQLAlchemy, Pytest and Docker

Project description

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

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.0a4.tar.gz (10.6 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.0a4-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: elefast-0.1.0a4.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","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.0a4.tar.gz
Algorithm Hash digest
SHA256 97a4ac9a5b8ea37a523f385497660320b610acf66db6ee2297a03b85614afd98
MD5 0a8018ebb3910e4ab4477604e605da5f
BLAKE2b-256 6af5b14970fb9e5dd61f0c390214bf5493bd6f7baad36b0fd1e7a0e3a30bcdbd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: elefast-0.1.0a4-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","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.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 d85b900af8d64933094e9e6f3fbc3f5cca5d518a753a46e0d1e93adc01dd8df4
MD5 7960ff3dd4e44b64c89672b7eaa53af0
BLAKE2b-256 dac313cb29e45577c28a4cc4660706a2236583ea72e3d3b38aaaf34ef5258dbb

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