Merge "Bump hacking"

This commit is contained in:
Zuul 2024-02-15 02:25:50 +00:00 committed by Gerrit Code Review
commit f07ad89f6c
8 changed files with 12 additions and 10 deletions

View File

@ -172,8 +172,8 @@ def schema_args(schema_getter, omit=None):
return _decorator
def pretty_choice_list(l):
return ', '.join("'%s'" % i for i in l)
def pretty_choice_list(choices):
return ', '.join("'%s'" % choice for choice in choices)
def has_version(client, version):

View File

@ -57,5 +57,5 @@ class HttpHeadersTest(base.ClientTestBase):
image = glanceclient.glance.images.update(image.id,
disk_format="qcow2")
except Exception as e:
self.assertFalse("415 Unsupported Media Type" in e.details)
self.assertNotIn("415 Unsupported Media Type", e.details)
time.sleep(5)

View File

@ -242,7 +242,7 @@ class TestUtils(testtools.TestCase):
# Regression test for bug 1461678.
def _iterate(i):
for chunk in i:
raise(IOError)
raise IOError()
data = io.StringIO('somestring')
data.close = mock.Mock()

View File

@ -1468,7 +1468,7 @@ class TestController(testtools.TestCase):
headers = {'x-openstack-request-id': 'req-1234'}
fixture_idx = '/v2/images/%s' % (image_id)
orig_locations = data_fixtures[fixture_idx]['GET'][1]['locations']
loc_map = dict([(l['url'], l) for l in orig_locations])
loc_map = dict([(loc['url'], loc) for loc in orig_locations])
loc_map[new_loc['url']] = new_loc
mod_patch = [{'path': '/locations', 'op': 'replace',
'value': list(loc_map.values())}]

View File

@ -61,8 +61,8 @@ _SCHEMA = schemas.Schema({
def compare_json_patches(a, b):
"""Return 0 if a and b describe the same JSON patch."""
return(jsonpatch.JsonPatch.from_string(a) ==
jsonpatch.JsonPatch.from_string(b))
return (jsonpatch.JsonPatch.from_string(a) ==
jsonpatch.JsonPatch.from_string(b))
class TestSchemaProperty(testtools.TestCase):

View File

@ -514,7 +514,7 @@ class Controller(object):
:returns: None
"""
image = self._get_image_with_locations_or_fail(image_id)
current_urls = [l['url'] for l in image.locations]
current_urls = [loc['url'] for loc in image.locations]
missing_locs = url_set.difference(set(current_urls))
if missing_locs:
@ -541,7 +541,7 @@ class Controller(object):
:returns: The updated image
"""
image = self._get_image_with_locations_or_fail(image_id)
url_map = dict([(l['url'], l) for l in image.locations])
url_map = dict([(loc['url'], loc) for loc in image.locations])
if url not in url_map:
raise exc.HTTPNotFound('Unknown URL: %s, the URL must be one of'
' existing locations of current image' %

View File

@ -526,6 +526,7 @@ def do_member_get(gc, args):
member = gc.image_members.get(args.image_id, args.member_id)
utils.print_dict(member)
@utils.arg('image_id', metavar='<IMAGE_ID>',
help=_('Image from which to remove member.'))
@utils.arg('member_id', metavar='<MEMBER_ID>',
@ -596,6 +597,7 @@ def do_import_info(gc, args):
else:
utils.print_dict(import_info)
@utils.arg('--detail', default=False, action='store_true',
help='Shows details of stores. Admin only.')
def do_stores_info(gc, args):

View File

@ -1,4 +1,4 @@
hacking>=3.0.1,<3.1.0 # Apache-2.0
hacking>=6.1.0,<6.2.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
os-client-config>=1.28.0 # Apache-2.0
stestr>=2.0.0 # Apache-2.0