summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-11-23 15:23:52 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2014-11-23 15:23:52 -0500
commit2639f8f5f85294a84414a5adeb8bcce601e8977a (patch)
treee1a37dbede088ce44759d7adf37abb4e9280d6c9 /tests
parent6b0b54b35bb4039a59d3ac53c58b998800072726 (diff)
downloadalembic-2639f8f5f85294a84414a5adeb8bcce601e8977a.tar.gz
- Relative revision identifiers as used with ``alembic upgrade``,
``alembic downgrade`` and ``alembic history`` can be combined with specific revisions as well, e.g. ``alembic upgrade ae10+3``, to produce a migration target relative to the given exact version.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_version_traversal.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/test_version_traversal.py b/tests/test_version_traversal.py
index 1fc99e2..72ae03a 100644
--- a/tests/test_version_traversal.py
+++ b/tests/test_version_traversal.py
@@ -99,6 +99,18 @@ class RevisionPathTest(MigrationTest):
set([e.revision])
)
+ self._assert_upgrade(
+ "%s+2" % b.revision, a.revision,
+ [self.up_(b), self.up_(c), self.up_(d)],
+ set([d.revision])
+ )
+
+ self._assert_upgrade(
+ "%s-2" % d.revision, a.revision,
+ [self.up_(b)],
+ set([b.revision])
+ )
+
def test_invalid_relative_upgrade_path(self):
a, b, c, d, e = self.a, self.b, self.c, self.d, self.e
assert_raises_message(
@@ -142,6 +154,18 @@ class RevisionPathTest(MigrationTest):
set([b.revision])
)
+ self._assert_downgrade(
+ "%s+2" % a.revision, d.revision,
+ [self.down_(d)],
+ set([c.revision])
+ )
+
+ self._assert_downgrade(
+ "%s-2" % c.revision, d.revision,
+ [self.down_(d), self.down_(c), self.down_(b)],
+ set([a.revision])
+ )
+
def test_invalid_relative_downgrade_path(self):
a, b, c, d, e = self.a, self.b, self.c, self.d, self.e
assert_raises_message(
@@ -275,6 +299,28 @@ class BranchedPathTest(MigrationTest):
set([a.revision])
)
+ def test_relative_upgrade(self):
+ a, b, c1, d1, c2, d2 = (
+ self.a, self.b, self.c1, self.d1, self.c2, self.d2
+ )
+
+ self._assert_upgrade(
+ "c2branch@head-1", b.revision,
+ [self.up_(c2)],
+ set([c2.revision])
+ )
+
+ def test_relative_downgrade(self):
+ a, b, c1, d1, c2, d2 = (
+ self.a, self.b, self.c1, self.d1, self.c2, self.d2
+ )
+
+ self._assert_downgrade(
+ "c2branch@base+2", [d2.revision, d1.revision],
+ [self.down_(d2), self.down_(c2), self.down_(d1)],
+ set([c1.revision])
+ )
+
class BranchFromMergepointTest(MigrationTest):
"""this is a form that will come up frequently in the