summaryrefslogtreecommitdiff
path: root/tests/test_script_consumption.py
diff options
context:
space:
mode:
authorjpassaro <john.a.passaro@gmail.com>2017-07-10 15:51:46 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-07-18 15:09:46 -0400
commite88131f2c03445fd183dfee13ad4bc9ec8ef96ea (patch)
tree80f9812c94e5dd9ff298f465cff1cc724c0ad7ea /tests/test_script_consumption.py
parent11b0e8a5b6c57e9900b86554e66c7b2ad3fe38cd (diff)
downloadalembic-e88131f2c03445fd183dfee13ad4bc9ec8ef96ea.tar.gz
address stamp issues in on_version_apply callback
* add callback tests with stamp present * fix bug in stamp MigrationInfo construction * adjust MigrationInfo API to reflect existence of stamps with multiple up revisions Change-Id: I308d1de7854542d4d12bcc743bb5ed7e8e2fbefc Pull-request: https://bitbucket.org/zzzeek/alembic/pull-requests/68
Diffstat (limited to 'tests/test_script_consumption.py')
-rw-r--r--tests/test_script_consumption.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/test_script_consumption.py b/tests/test_script_consumption.py
index 5ffa24a..14dd783 100644
--- a/tests/test_script_consumption.py
+++ b/tests/test_script_consumption.py
@@ -36,6 +36,7 @@ class ApplyVersionsFunctionalTest(TestBase):
self._test_004_downgrade()
self._test_005_upgrade()
self._test_006_upgrade_again()
+ self._test_007_stamp_upgrade()
def _test_001_revisions(self):
self.a = a = util.rev_id()
@@ -129,6 +130,13 @@ class ApplyVersionsFunctionalTest(TestBase):
assert db.dialect.has_table(db.connect(), 'bar')
assert not db.dialect.has_table(db.connect(), 'bat')
+ def _test_007_stamp_upgrade(self):
+ command.stamp(self.cfg, self.c)
+ db = self.bind
+ assert db.dialect.has_table(db.connect(), 'foo')
+ assert db.dialect.has_table(db.connect(), 'bar')
+ assert not db.dialect.has_table(db.connect(), 'bat')
+
class SourcelessApplyVersionsTest(ApplyVersionsFunctionalTest):
sourceless = True
@@ -194,13 +202,13 @@ class CallbackEnvironmentTest(ApplyVersionsFunctionalTest):
assert hasattr(kw['ctx'], 'get_current_revision')
step = kw['step']
- assert isinstance(getattr(step, 'is_upgrade', None), bool)
- assert isinstance(getattr(step, 'is_stamp', None), bool)
- assert isinstance(getattr(step, 'is_migration', None), bool)
- assert isinstance(getattr(step, 'up_revision_id', None),
- compat.string_types)
- assert isinstance(getattr(step, 'up_revision', None), Script)
- for revtype in 'down', 'source', 'destination':
+ assert isinstance(step.is_upgrade, bool)
+ assert isinstance(step.is_stamp, bool)
+ assert isinstance(step.is_migration, bool)
+ assert isinstance(step.up_revision_id, compat.string_types)
+ assert isinstance(step.up_revision, Script)
+
+ for revtype in 'up', 'down', 'source', 'destination':
revs = getattr(step, '%s_revisions' % revtype)
assert isinstance(revs, tuple)
for rev in revs: