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.0
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.0.tar.gz | 21.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| alembic_gauntlet-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 50.4 kB
Release files / alembic_gauntlet-0.3.0.tar.gz
| Download URL | alembic_gauntlet-0.3.0.tar.gz |
|---|---|
| Size | 21.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a486e9458db5a6be29e34cd75d47d3b4bd88da9f297ffd687c74cbb72e998e6
|
|
BLAKE2b-256 checksum How to use checksums |
40266d1f683d9771deca23ce1c30e8cdf3ab6a3ea00054f85c925453b4566047
|
| 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.3.0-py3-none-any.whl
| Download URL | alembic_gauntlet-0.3.0-py3-none-any.whl |
|---|---|
| Size | 28.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5deb98770b808705c5434357bf4049e384c195b573654e61a3346485216c78cc
|
|
BLAKE2b-256 checksum How to use checksums |
c4f9c7cd3041224e4f69ee2249dbc0d9a211099103790f9f0b7996719d57c1da
|
| 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}
|