alembic-gauntlet
Testing toolkit for Alembic migrations — run your migrations through the gauntlet
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 seven 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 backtest_migrations_up_to_date— schema matches ORM modelstest_check_constraints_match— CHECK constraints match ORM models, by nametest_enum_values_match— enum values match ORM models, in ordertest_single_head_revision— no unmerged branchestest_downgrade_all_the_way— full downgrade to basetest_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.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| alembic_gauntlet-0.3.1.tar.gz | 21.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| alembic_gauntlet-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.1 kB
Release files / alembic_gauntlet-0.3.1.tar.gz
| Download URL | alembic_gauntlet-0.3.1.tar.gz |
|---|---|
| Size | 21.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a31ff62290ec7b2ff653c2d90999796687c4e0f131b1e609f60bdb1d1df05aac
|
|
BLAKE2b-256 checksum How to use checksums |
c75d85a67e58a7f998b06bfa90f2c4a152291d5de633bbd92ed3bbb640993da6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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.3.1-py3-none-any.whl
| Download URL | alembic_gauntlet-0.3.1-py3-none-any.whl |
|---|---|
| Size | 29.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c529409a01f23a775b36ea9e64507f036678db6c06230e21aa68d14a5a59cb8
|
|
BLAKE2b-256 checksum How to use checksums |
188e196ac862bf708558936dd8b9378a95f4d5009c06f04d0a6e9768784dc3f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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}
|