Skip to main content

alembic-gauntlet

Testing toolkit for Alembic migrations — run your migrations through the gauntlet

PyPI Python License CI codecov Docs

Installation

pip install "alembic-gauntlet[asyncio]"

The asyncio extra installs pytest-asyncio, which is not optional in practice: the inherited tests and both async fixtures are plain async def, so a suite without it errors out instead of running. It also has to be in auto mode:

# pyproject.toml
[tool.pytest.ini_options]
asyncio_mode = "auto"

Requirements: Python 3.10+, PostgreSQL, and an async driver such as asyncpg

Quick start

import pytest
from alembic_gauntlet import MigrationTestBase
from sqlalchemy import MetaData
from myapp.db import Base


@pytest.mark.integration
class TestMyMigrations(MigrationTestBase):
    """All five tests inherited automatically."""

    @pytest.fixture
    def orm_metadata(self) -> MetaData:
        return Base.metadata

    @pytest.fixture(scope="session")
    def migration_db_url(self) -> str:
        return "postgresql+asyncpg://user:pass@localhost/testdb"

That's it! You now have:

  • test_stairway_upgrade_downgrade — each migration forward and back
  • test_migrations_up_to_date — schema matches ORM models
  • test_single_head_revision — no unmerged branches
  • test_downgrade_all_the_way — full downgrade to base
  • test_naming_conventions — indexes and FKs follow conventions

Documentation

Full documentation at bedrock-python.github.io/alembic-gauntlet.

  • For AI agents — the whole library on one page, written for a coding assistant.

License

Apache 2.0 — see LICENSE.

Metadata

Release files for alembic-gauntlet 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alembic-gauntlet 0.2.2
File Size Uploaded
alembic_gauntlet-0.2.2.tar.gz 19.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for alembic-gauntlet 0.2.2
File Interpreter ABI Platform
alembic_gauntlet-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 46.8 kB

Release files / alembic_gauntlet-0.2.2.tar.gz

Download URL alembic_gauntlet-0.2.2.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
30aad239b1d95c313ca000bafe1f4e5dce8630da5ed39ae2d9114ab3b8047e10
BLAKE2b-256 checksum
How to use checksums
5cf2b703299e41520c74d40519387229d47c1d37856a09e7c7a9bc7df999f564
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / alembic_gauntlet-0.2.2-py3-none-any.whl

Download URL alembic_gauntlet-0.2.2-py3-none-any.whl
Size 27.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8df68f08605be5ee8d0dccc75229bd105995de1ad1f36307415686710d19c86a
BLAKE2b-256 checksum
How to use checksums
881613108a129a0bae93a730deba4900a3678069dfa0fed239133c923463aced
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.3.0

2 release files

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page