Docs/Integrate/pytest-dblift
OSS

pytest-dblift

pytest-dblift is a separate package that applies your migrations before tests and exposes a client fixture.

pip install pytest-dblift
python
def test_schema(dblift_migrated_db, dblift_client): info = dblift_client.info() assert not getattr(info, "pending_migrations", None)

dblift_migrated_db applies pending migrations (function scope by default). dblift_client is a live DBLiftClient.

CLI options

OptionWhat it does
--dblift-urlDatabase URL used to build the client when no config fixture override is provided.
--dblift-migrations-dirPath to the migrations directory, or a comma-separated list. Defaults to migrations.

Works with xdist: SQLite workers get isolated files.

See SQLAlchemy for from_sqlalchemy and Python migrations when the target is a document store.

On this page