Merge "Port script utils to Python 3"

This commit is contained in:
Jenkins 2015-10-21 15:37:47 +00:00 committed by Gerrit Code Review
commit 047773ccde
3 changed files with 9 additions and 6 deletions

View File

@ -97,9 +97,9 @@ def validate_location_uri(location):
elif location.startswith(("file:///", "filesystem:///")):
msg = _("File based imports are not allowed. Please use a non-local "
"source of image data.")
# NOTE: raise Exception and let the encompassing block save
# the error msg in the task.message.
raise StandardError(msg)
# NOTE: raise BadStoreUri and let the encompassing block save the error
# msg in the task.message.
raise exception.BadStoreUri(msg)
else:
# TODO(nikhil): add other supported uris

View File

@ -89,9 +89,10 @@ class TestScriptsUtils(test_utils.BaseTestCase):
script_utils.validate_location_uri, '')
def test_validate_location_file_location_error(self):
self.assertRaises(StandardError, script_utils.validate_location_uri,
"file:///tmp")
self.assertRaises(StandardError, script_utils.validate_location_uri,
self.assertRaises(exception.BadStoreUri,
script_utils.validate_location_uri, "file:///tmp")
self.assertRaises(exception.BadStoreUri,
script_utils.validate_location_uri,
"filesystem:///tmp")
def test_validate_location_unsupported_error(self):

View File

@ -28,6 +28,8 @@ commands =
glance.tests.unit.async.flows.test_introspect \
glance.tests.unit.async.test_async \
glance.tests.unit.async.test_taskflow_executor \
glance.tests.unit.common.scripts.image_import.test_main \
glance.tests.unit.common.scripts.test_scripts_utils \
glance.tests.unit.common.test_client \
glance.tests.unit.common.test_config \
glance.tests.unit.common.test_exception \