diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-11-20 20:21:06 -0500 |
---|---|---|
committer | Roman Podoliaka <rpodolyaka@mirantis.com> | 2014-11-21 12:32:04 +0200 |
commit | 549ba15e3055d269c6323e6b8b6d072925ad0007 (patch) | |
tree | 4bf15692324838a66645ca1fd2a9d6be97de8b3a | |
parent | 8c478fb98690d848951c7d40a6ec44bf5522833c (diff) | |
download | oslo-db-549ba15e3055d269c6323e6b8b6d072925ad0007.tar.gz |
Repair include_object to accommodate new objects
The tests in tests/sqlalchemy/test_migrations.py which expect
to see changes in unique constraints fail due to the
assumption that the "include_object" feature of Alembic only
deals with the 'table' and 'column' constructs. As Alembic
0.7.0 has added include_object support for 'index' and
'unique_constraint', this method should not be limiting
itself to not include objects that it's testing for.
Tests won't pass on Alembic 0.7.0 without this patch.
Change-Id: Ia71446bb8c0b248c6310534deb290524e3946987
-rw-r--r-- | tests/sqlalchemy/test_migrations.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/sqlalchemy/test_migrations.py b/tests/sqlalchemy/test_migrations.py index db6c9c8..1c560e8 100644 --- a/tests/sqlalchemy/test_migrations.py +++ b/tests/sqlalchemy/test_migrations.py @@ -240,7 +240,10 @@ class ModelsMigrationSyncMixin(test.BaseTestCase): self.metadata_migrations.create_all(bind=engine) def include_object(self, object_, name, type_, reflected, compare_to): - return type_ == 'table' and name == 'testtbl' or type_ == 'column' + if type_ == 'table': + return name == 'testtbl' + else: + return True def _test_models_not_sync(self): self.metadata_migrations.clear() @@ -281,7 +284,7 @@ class ModelsMigrationSyncMixin(test.BaseTestCase): 'Models and migration scripts aren\'t in sync:')) self.assertIn('testtbl', msg) self.assertIn('spam', msg) - self.assertIn('eggs', msg) + self.assertIn('eggs', msg) # test that the unique constraint is added self.assertIn('foo', msg) self.assertIn('bar', msg) self.assertIn('bool_wo_default', msg) |