summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCaselIT <cfederico87@gmail.com>2022-05-02 22:53:39 +0200
committerCaselIT <cfederico87@gmail.com>2022-05-03 22:42:40 +0200
commit1684d0ee89c0fc6b0b90bc5db614468b31119e9d (patch)
treeef855470bd910e7ecbebc00b7f9ecb1614f0058c /tests
parentcfe92fac6794515d3aa3b995e288b11d5c9437fa (diff)
downloadalembic-1684d0ee89c0fc6b0b90bc5db614468b31119e9d.tar.gz
Fix downgrade with effective head
Fixed issue where downgrade using a relative revision would fail in case of multiple branches with a single effectively head due to interdependencies between revisions. Fixes: #1026 Change-Id: I79f5595fb9d03124db8039345055571a9134eecd
Diffstat (limited to 'tests')
-rw-r--r--tests/test_revision.py44
1 files changed, 40 insertions, 4 deletions
diff --git a/tests/test_revision.py b/tests/test_revision.py
index 61998bf..0d5bfd5 100644
--- a/tests/test_revision.py
+++ b/tests/test_revision.py
@@ -239,10 +239,7 @@ class DownIterateTest(TestBase):
edges, list(reversed(result))
)
- eq_(
- result,
- assertion,
- )
+ eq_(result, assertion)
class DiamondTest(DownIterateTest):
@@ -573,6 +570,45 @@ class MultipleBranchTest(DownIterateTest):
)
+class MultipleBranchEffectiveHead(DownIterateTest):
+ def setUp(self):
+ self.map = RevisionMap(
+ lambda: [
+ Revision("y1", None, branch_labels="y"),
+ Revision("x1", None, branch_labels="x"),
+ Revision("y2", "y1", dependencies="x1"),
+ Revision("x2", "x1"),
+ ]
+ )
+
+ def test_other_downgrade(self):
+ self._assert_iteration(
+ ("x2", "y2"),
+ "x@-1",
+ ["x2"],
+ inclusive=False,
+ select_for_downgrade=True,
+ )
+
+ def test_use_all_current(self):
+ self._assert_iteration(
+ ("x1", "y2"),
+ "x@-1",
+ ["y2", "x1"],
+ inclusive=False,
+ select_for_downgrade=True,
+ )
+
+ def test_effective_head(self):
+ self._assert_iteration(
+ "y2",
+ "x@-1",
+ ["y2", "x1"],
+ inclusive=False,
+ select_for_downgrade=True,
+ )
+
+
class BranchTravellingTest(DownIterateTest):
"""test the order of revs when going along multiple branches.