Skip to content

Commit

Permalink
release: v2.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
jrcastro2 committed Jun 8, 2023
1 parent 69ccc27 commit 0ddf0f5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
Changes
=======

Version 2.1.5 (released 2023-06-06)

- fixtures: add alembic test fixture

Version 2.1.4 (released 2023-06-02)

- user fixture: use identity ID as int
Expand Down
2 changes: 1 addition & 1 deletion pytest_invenio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,6 @@ def test_browser(live_server, browser):
"""


__version__ = "2.1.4"
__version__ = "2.1.5"

__all__ = ("__version__",)
12 changes: 8 additions & 4 deletions pytest_invenio/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,8 +887,11 @@ def test_alembic():
implements that behaviour by upgrading per revision_id instead of upgrade from scratch to the latest.
"""

def _test_alembic(app, db, module_name, downgrade_target="base"):
"""Test alembic recipes for a concrete module."""
def _test_alembic(app, db, module_name, downgrade_targets=["base"]):
"""Test alembic recipes for a concrete module.
Order in downgrade_targets is important as the revision_ids will be executed in that order when downgrading.
"""

def _sort_revision_ids(scripts_list):
"""Sorts the scripts based on the previous and next revisions and returns a list of sorted revision ids."""
Expand Down Expand Up @@ -924,10 +927,11 @@ def _sort_revision_ids(scripts_list):
ext.alembic.upgrade(target=revision_id)
ext.alembic.upgrade() # Update all the rest of the branches to the latest heads
assert not ext.alembic.compare_metadata()
ext.alembic.downgrade(target=downgrade_target)
for downgrade_target in downgrade_targets:
ext.alembic.downgrade(target=downgrade_target)
for revision_id in revision_ids:
ext.alembic.upgrade(target=revision_id)

ext.alembic.upgrade() # Update all the rest of the branches to the latest heads
assert not ext.alembic.compare_metadata()

return _test_alembic

0 comments on commit 0ddf0f5

Please sign in to comment.