Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /MTSWebServices_data-rentgen /tests /test_database /test_migrations.py
| from __future__ import annotations | |
| import pytest | |
| from alembic.autogenerate import compare_metadata | |
| from alembic.runtime.migration import MigrationContext | |
| from sqlalchemy import Connection, MetaData, create_engine | |
| from sqlalchemy.pool import NullPool | |
| from data_rentgen.db.models import Base | |
| pytestmark = [pytest.mark.db] | |
| def get_diff_db_metadata(connection: Connection, metadata: MetaData): | |
| migration_ctx = MigrationContext.configure(connection) | |
| return compare_metadata(context=migration_ctx, metadata=metadata) | |
| def test_migrations_up_to_date(request: pytest.FixtureRequest, empty_db_url: str, run_migrations): | |
| engine = create_engine(empty_db_url, poolclass=NullPool) | |
| def finalizer(): | |
| engine.dispose() | |
| request.addfinalizer(finalizer) | |
| with engine.connect() as connection: | |
| diff = get_diff_db_metadata(connection, metadata=Base.metadata) | |
| assert not diff | |
Xet Storage Details
- Size:
- 904 Bytes
- Xet hash:
- a0073eae015ccb1a576af1cf02ce3142ed5fecf83a80f33bed652aecc71008b6
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.