Skip to content

Commit

Permalink
only check that the model matches with sqlalchemy-migrate==0.7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Jul 11, 2011
1 parent c9d7636 commit 8e23503
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions master/buildbot/test/integration/test_upgrade.py
Expand Up @@ -22,6 +22,7 @@
from twisted.internet import defer
from twisted.trial import unittest
import sqlalchemy as sa
import migrate
import migrate.versioning.api
from migrate.versioning import schemadiff
from buildbot.db import connector
Expand Down Expand Up @@ -94,6 +95,14 @@ def tearDown(self):
self.tearDownUpgradeTest()

def assertModelMatches(self):
# this patch only applies to sqlalchemy-migrate-0.7.x. We prefer to
# skip the remainder of the test, even though some significant testing
# has already occcurred (verify_thd), to indicate that the test was not
# complete.
if (not hasattr(migrate, '__version__')
or not migrate.__version__.startswith('0.7.')):
raise unittest.SkipTest("model comparison skipped: unsupported "
"version of sqlalchemy-migrate")
self.patch(schemadiff, 'getDiffOfModelAgainstDatabase',
getDiffMonkeyPatch)
def comp(engine):
Expand All @@ -109,7 +118,8 @@ def comp(engine):
# this test on such platforms.
def catch_TypeError(f):
f.trap(TypeError)
raise unittest.SkipTest, "bugs in schema reflection on this platform"
raise unittest.SkipTest("model comparison skipped: bugs in schema "
"reflection on this sqlite version")
d.addErrback(catch_TypeError)
def check(diff):
if diff:
Expand All @@ -122,8 +132,8 @@ def do_test_upgrade(self, pre_callbacks=[]):
for cb in pre_callbacks:
d.addCallback(cb)
d.addCallback(lambda _ : self.db.model.upgrade())
d.addCallback(lambda _ : self.assertModelMatches())
d.addCallback(lambda _ : self.db.pool.do(self.verify_thd))
d.addCallback(lambda _ : self.assertModelMatches())
return d


Expand Down

0 comments on commit 8e23503

Please sign in to comment.