diff --git a/glanceclient/common/utils.py b/glanceclient/common/utils.py index ff1ffd16..cebc9dff 100644 --- a/glanceclient/common/utils.py +++ b/glanceclient/common/utils.py @@ -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): diff --git a/glanceclient/tests/functional/v2/test_http_headers.py b/glanceclient/tests/functional/v2/test_http_headers.py index 15964442..d4c9d9cc 100644 --- a/glanceclient/tests/functional/v2/test_http_headers.py +++ b/glanceclient/tests/functional/v2/test_http_headers.py @@ -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) diff --git a/glanceclient/tests/unit/test_utils.py b/glanceclient/tests/unit/test_utils.py index dfa7a44a..805e7554 100644 --- a/glanceclient/tests/unit/test_utils.py +++ b/glanceclient/tests/unit/test_utils.py @@ -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() diff --git a/glanceclient/tests/unit/v2/test_images.py b/glanceclient/tests/unit/v2/test_images.py index 72512031..3ce12c16 100644 --- a/glanceclient/tests/unit/v2/test_images.py +++ b/glanceclient/tests/unit/v2/test_images.py @@ -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())}] diff --git a/glanceclient/tests/unit/v2/test_schemas.py b/glanceclient/tests/unit/v2/test_schemas.py index c01d8bd5..9e060d4f 100644 --- a/glanceclient/tests/unit/v2/test_schemas.py +++ b/glanceclient/tests/unit/v2/test_schemas.py @@ -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): diff --git a/glanceclient/v2/images.py b/glanceclient/v2/images.py index e19f86ef..216837d0 100644 --- a/glanceclient/v2/images.py +++ b/glanceclient/v2/images.py @@ -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' % diff --git a/glanceclient/v2/shell.py b/glanceclient/v2/shell.py index 64c5cbd7..db74b0b2 100644 --- a/glanceclient/v2/shell.py +++ b/glanceclient/v2/shell.py @@ -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='', help=_('Image from which to remove member.')) @utils.arg('member_id', metavar='', @@ -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): diff --git a/test-requirements.txt b/test-requirements.txt index d635495b..39b8dcd3 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -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