Use correct config key in alembic extension
While the value we're looking for is passed into the Extension as 'alembic_repo_path' it is actually stored in the alembic config as 'script_location'. This change fixes the call to the alembic config and retrieves 'script_location' instead. Change-Id: Ia328e8230d33dc063c0d377e04f15f1ccaa4d500 Closes-Bug: #1486655
This commit is contained in:
parent
4e83ad8299
commit
27b7301438
@ -95,7 +95,7 @@ class AlembicExtension(ext_base.MigrationExtensionBase):
|
||||
if rev_id in ['base', 'head']:
|
||||
return True
|
||||
script = alembic_script.ScriptDirectory(
|
||||
self.config.get_main_option('alembic_repo_path'))
|
||||
self.config.get_main_option('script_location'))
|
||||
try:
|
||||
script.get_revision(rev_id)
|
||||
return True
|
||||
|
@ -103,6 +103,8 @@ class TestAlembicExtension(test_base.BaseTestCase):
|
||||
# since alembic_script is mocked and no exception is raised, call
|
||||
# will result in success
|
||||
self.assertIs(True, self.alembic.has_revision('test'))
|
||||
self.alembic.config.get_main_option.assert_called_once_with(
|
||||
'script_location')
|
||||
mocked.ScriptDirectory().get_revision.assert_called_once_with(
|
||||
'test')
|
||||
self.assertIs(True, self.alembic.has_revision(None))
|
||||
@ -116,6 +118,8 @@ class TestAlembicExtension(test_base.BaseTestCase):
|
||||
self.alembic.config.get_main_option = mock.Mock()
|
||||
# exception is raised, the call should be false
|
||||
self.assertIs(False, self.alembic.has_revision('test'))
|
||||
self.alembic.config.get_main_option.assert_called_once_with(
|
||||
'script_location')
|
||||
mocked.ScriptDirectory().get_revision.assert_called_once_with(
|
||||
'test')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user