Throw DBMigrationError instead of DbMigrationError.
Stop throwing the deprecated DbMigrationError exception, Use the new DBMigrationError exception instead, so that the consumers can catch the new exception. DbMigrationError will not be removed until no consumers still use it. Change-Id: Iab0566cf9f4552e91fa417e64472fa106e8bc86d
This commit is contained in:
parent
e9a9701d54
commit
9a5a3b3395
@ -78,7 +78,7 @@ def db_sync(engine, abs_path, version=None, init_version=0, sanity_check=True):
|
||||
try:
|
||||
migration = versioning_api.upgrade(engine, repository, version)
|
||||
except Exception as ex:
|
||||
raise exception.DbMigrationError(ex)
|
||||
raise exception.DBMigrationError(ex)
|
||||
else:
|
||||
migration = versioning_api.downgrade(engine, repository,
|
||||
version)
|
||||
|
@ -195,16 +195,16 @@ class TestMigrationCommon(test_base.DbTestCase):
|
||||
@mock.patch.object(versioning_api, 'upgrade')
|
||||
def test_db_sync_script_not_present(self, upgrade):
|
||||
# For non existent migration script file sqlalchemy-migrate will raise
|
||||
# VersionNotFoundError which will be wrapped in DbMigrationError.
|
||||
# VersionNotFoundError which will be wrapped in DBMigrationError.
|
||||
upgrade.side_effect = migrate_exception.VersionNotFoundError
|
||||
self.assertRaises(db_exception.DbMigrationError,
|
||||
self.assertRaises(db_exception.DBMigrationError,
|
||||
migration.db_sync, self.engine, self.path,
|
||||
self.test_version + 1)
|
||||
|
||||
@mock.patch.object(versioning_api, 'upgrade')
|
||||
def test_db_sync_known_error_raised(self, upgrade):
|
||||
upgrade.side_effect = migrate_exception.KnownError
|
||||
self.assertRaises(db_exception.DbMigrationError,
|
||||
self.assertRaises(db_exception.DBMigrationError,
|
||||
migration.db_sync, self.engine, self.path,
|
||||
self.test_version + 1)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user