diff --git a/cinderclient/_i18n.py b/cinderclient/_i18n.py index 96c924655..9a38e5568 100644 --- a/cinderclient/_i18n.py +++ b/cinderclient/_i18n.py @@ -37,7 +37,7 @@ _P = _translators.plural_form def get_available_languages(): - return oslo_i18n.get_available_languages(DOMAIN) + return oslo_i18n.get_available_languages(DOMAIN) def enable_lazy(): diff --git a/cinderclient/client.py b/cinderclient/client.py index 57dc52316..fb84861f1 100644 --- a/cinderclient/client.py +++ b/cinderclient/client.py @@ -14,9 +14,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -""" -OpenStack Client interface. Handles the REST calls and responses. -""" +"""OpenStack Client interface. Handles the REST calls and responses.""" from __future__ import print_function @@ -429,7 +427,7 @@ class HTTPClient(object): url = self.management_url + url resp, body = self.request(url, method, **kwargs) return resp, body - except exceptions.BadRequest as e: + except exceptions.BadRequest: if attempts > self.retries: raise except exceptions.Unauthorized: diff --git a/cinderclient/tests/unit/test_shell.py b/cinderclient/tests/unit/test_shell.py index 305a37ce6..c82c1b9db 100644 --- a/cinderclient/tests/unit/test_shell.py +++ b/cinderclient/tests/unit/test_shell.py @@ -118,10 +118,10 @@ class ShellTest(utils.TestCase): def test_help(self): # Some expected help output, including microversioned commands required = [ - '.*?^usage: ', - '.*?(?m)^\s+create\s+Creates a volume.', - '.*?(?m)^\s+summary\s+Get volumes summary.', - '.*?(?m)^Run "cinder help SUBCOMMAND" for help on a subcommand.', + r'.*?^usage: ', + r'.*?(?m)^\s+create\s+Creates a volume.', + r'.*?(?m)^\s+summary\s+Get volumes summary.', + r'.*?(?m)^Run "cinder help SUBCOMMAND" for help on a subcommand.', ] help_text = self.shell('help') for r in required: @@ -130,8 +130,8 @@ class ShellTest(utils.TestCase): def test_help_on_subcommand(self): required = [ - '.*?^usage: cinder list', - '.*?(?m)^Lists all volumes.', + r'.*?^usage: cinder list', + r'.*?(?m)^Lists all volumes.', ] help_text = self.shell('help list') for r in required: @@ -140,8 +140,8 @@ class ShellTest(utils.TestCase): def test_help_on_subcommand_mv(self): required = [ - '.*?^usage: cinder summary', - '.*?(?m)^Get volumes summary.', + r'.*?^usage: cinder summary', + r'.*?(?m)^Get volumes summary.', ] help_text = self.shell('help summary') for r in required: diff --git a/cinderclient/tests/unit/v2/test_limits.py b/cinderclient/tests/unit/v2/test_limits.py index 1bc900f54..b1732e58b 100644 --- a/cinderclient/tests/unit/v2/test_limits.py +++ b/cinderclient/tests/unit/v2/test_limits.py @@ -33,60 +33,61 @@ def _get_default_RateLimit(verb="verb1", uri="uri1", regex="regex1", class TestLimits(utils.TestCase): def test_repr(self): - l = limits.Limits(None, {"foo": "bar"}, resp=REQUEST_ID) - self.assertEqual("", repr(l)) - self._assert_request_id(l) + limit = limits.Limits(None, {"foo": "bar"}, resp=REQUEST_ID) + self.assertEqual("", repr(limit)) + self._assert_request_id(limit) def test_absolute(self): - l = limits.Limits(None, - {"absolute": {"name1": "value1", "name2": "value2"}}, - resp=REQUEST_ID) + limit = limits.Limits( + None, + {"absolute": {"name1": "value1", "name2": "value2"}}, + resp=REQUEST_ID) l1 = limits.AbsoluteLimit("name1", "value1") l2 = limits.AbsoluteLimit("name2", "value2") - for item in l.absolute: + for item in limit.absolute: self.assertIn(item, [l1, l2]) - self._assert_request_id(l) + self._assert_request_id(limit) def test_rate(self): - l = limits.Limits(None, - { - "rate": [ - { - "uri": "uri1", - "regex": "regex1", - "limit": [ - { - "verb": "verb1", - "value": "value1", - "remaining": "remain1", - "unit": "unit1", - "next-available": "next1", - }, - ], - }, - { - "uri": "uri2", - "regex": "regex2", - "limit": [ - { - "verb": "verb2", - "value": "value2", - "remaining": "remain2", - "unit": "unit2", - "next-available": "next2", - }, - ], - }, - ], - }, - resp=REQUEST_ID) + limit = limits.Limits( + None, + { + "rate": [ + { + "uri": "uri1", + "regex": "regex1", + "limit": [ + { + "verb": "verb1", + "value": "value1", + "remaining": "remain1", + "unit": "unit1", + "next-available": "next1", + }, + ], + }, + { + "uri": "uri2", + "regex": "regex2", + "limit": [ + { + "verb": "verb2", + "value": "value2", + "remaining": "remain2", + "unit": "unit2", + "next-available": "next2", + }, + ], + }, ], + }, + resp=REQUEST_ID) l1 = limits.RateLimit("verb1", "uri1", "regex1", "value1", "remain1", "unit1", "next1") l2 = limits.RateLimit("verb2", "uri2", "regex2", "value2", "remain2", "unit2", "next2") - for item in l.rate: + for item in limit.rate: self.assertIn(item, [l1, l2]) - self._assert_request_id(l) + self._assert_request_id(limit) class TestRateLimit(utils.TestCase): diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py index 1fb5cf85a..9067b064c 100644 --- a/cinderclient/v3/shell.py +++ b/cinderclient/v3/shell.py @@ -52,12 +52,12 @@ class AppendFilters(argparse.Action): default=None, help='Show enabled filters for specified resource. Default=None.') def do_list_filters(cs, args): - """List enabled filters. + """List enabled filters. - Symbol '~' after filter key means it supports inexact filtering. - """ - filters = cs.resource_filters.list(resource=args.resource) - shell_utils.print_resource_filter_list(filters) + Symbol '~' after filter key means it supports inexact filtering. + """ + filters = cs.resource_filters.list(resource=args.resource) + shell_utils.print_resource_filter_list(filters) @utils.arg('--filters', diff --git a/lower-constraints.txt b/lower-constraints.txt index 73d8a64c1..9e44ad897 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -12,7 +12,7 @@ fasteners==0.7.0 fixtures==3.0.0 flake8==2.5.5 future==0.16.0 -hacking==0.12.0 +hacking==2.0.0 idna==2.6 iso8601==0.1.11 jsonschema==2.6.0 diff --git a/test-requirements.txt b/test-requirements.txt index 662a346b6..562d2cd6c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,7 +3,7 @@ # process, which may cause wedges in the gate later. # Hacking already pins down pep8, pyflakes and flake8 -hacking>=1.1.0,<1.2.0 # Apache-2.0 +hacking>=2.0.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT fixtures>=3.0.0 # Apache-2.0/BSD diff --git a/tools/install_venv.py b/tools/install_venv.py index f10293ba8..03fe5afa6 100644 --- a/tools/install_venv.py +++ b/tools/install_venv.py @@ -71,5 +71,6 @@ def main(argv): install.install_dependencies() print_help(project, venv, root) + if __name__ == '__main__': main(sys.argv) diff --git a/tox.ini b/tox.ini index 7153e4748..8062bcdea 100644 --- a/tox.ini +++ b/tox.ini @@ -104,7 +104,7 @@ commands = {[testenv:functional]commands} [flake8] show-source = True -ignore = H404,H405,E122,E123,E128,E251 +ignore = H404,H405,E122,E123,E128,E251,W504 exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build [testenv:lower-constraints]