From c4e602fa070b52cc2d3c5052c623ae83f444a554 Mon Sep 17 00:00:00 2001 From: Javier Romero Castro Date: Tue, 6 Jun 2023 14:48:35 +0200 Subject: [PATCH] release: v2.1.5 --- CHANGES.rst | 4 ++++ pytest_invenio/__init__.py | 2 +- pytest_invenio/fixtures.py | 6 ++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 0ed351e..d49d983 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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 diff --git a/pytest_invenio/__init__.py b/pytest_invenio/__init__.py index a18636e..5c923d1 100644 --- a/pytest_invenio/__init__.py +++ b/pytest_invenio/__init__.py @@ -499,6 +499,6 @@ def test_browser(live_server, browser): """ -__version__ = "2.1.4" +__version__ = "2.1.5" __all__ = ("__version__",) diff --git a/pytest_invenio/fixtures.py b/pytest_invenio/fixtures.py index bcfc8fa..b42c0c5 100644 --- a/pytest_invenio/fixtures.py +++ b/pytest_invenio/fixtures.py @@ -15,11 +15,11 @@ import tempfile from datetime import datetime from warnings import warn -from invenio_db.utils import drop_alembic_version_table import importlib_metadata import pkg_resources import pytest +from invenio_db.utils import drop_alembic_version_table from pytest_flask.plugin import _make_test_response_class from selenium import webdriver @@ -886,8 +886,10 @@ def test_alembic(): done per version, meaning that every time a new version is installed alembic has to run, therefore this test 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 _sort_revision_ids(scripts_list): """Sorts the scripts based on the previous and next revisions and returns a list of sorted revision ids.""" revision_ids = [] @@ -920,7 +922,7 @@ def _sort_revision_ids(scripts_list): revision_ids = _sort_revision_ids(module_scripts) 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() ext.alembic.downgrade(target=downgrade_target) for revision_id in revision_ids: