Skip to content

Commit

Permalink
Merge pull request #5935 from freedomofpress/faster-alembic-tests
Browse files Browse the repository at this point in the history
In test_alembic.py, test upgrade/downgrade more efficiently
  • Loading branch information
zenmonkeykstop committed May 19, 2021
2 parents c399374 + c6a578e commit fb2c4f0
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions securedrop/tests/test_alembic.py
Expand Up @@ -121,23 +121,9 @@ def test_alembic_head_matches_db_models(journalist_app,


@pytest.mark.parametrize('migration', ALL_MIGRATIONS)
def test_alembic_migration_upgrade(alembic_config, config, migration):
# run migrations in sequence from base -> head
for mig in list_migrations(alembic_config, migration):
upgrade(alembic_config, mig)


@pytest.mark.parametrize('migration', ALL_MIGRATIONS)
def test_alembic_migration_downgrade(alembic_config, config, migration):
# upgrade to the parameterized test case ("head")
def test_alembic_migration_up_and_down(alembic_config, config, migration):
upgrade(alembic_config, migration)

# run migrations in sequence from "head" -> base
migrations = list_migrations(alembic_config, migration)
migrations.reverse()

for mig in migrations:
downgrade(alembic_config, mig)
downgrade(alembic_config, "base")


@pytest.mark.parametrize('migration', ALL_MIGRATIONS)
Expand Down

0 comments on commit fb2c4f0

Please sign in to comment.