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.0a5.tar.gz (10.9 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.0a5-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: elefast-0.1.0a5.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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.0a5.tar.gz
Algorithm Hash digest
SHA256 3dd119454d309397e28ea28303164217daf9192e276c504ddc6b904012cdedd0
MD5 6206accbeecfe32f1557066f04a6e73e
BLAKE2b-256 be256e8502f2ddf3afcb0f81269e5708f85cfb36ca624debb868575b1e67017a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: elefast-0.1.0a5-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 487f028cc12b482ec6120f0bd2c1b7b51a79a87066b96756309dbbad8a62f11d
MD5 f898bf7a63684af6aa15d5b62dcaf56c
BLAKE2b-256 f2d03c2c40932eb9214324f5a1d1eee892795f419de19c76ca745460157abad8

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