Merge "Raise hacking version to 2.0.0"

This commit is contained in:
Zuul 2020-02-12 15:54:32 +00:00 committed by Gerrit Code Review
commit dea742c940
9 changed files with 63 additions and 63 deletions

View File

@ -37,7 +37,7 @@ _P = _translators.plural_form
def get_available_languages(): def get_available_languages():
return oslo_i18n.get_available_languages(DOMAIN) return oslo_i18n.get_available_languages(DOMAIN)
def enable_lazy(): def enable_lazy():

View File

@ -14,9 +14,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # 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 from __future__ import print_function
@ -429,7 +427,7 @@ class HTTPClient(object):
url = self.management_url + url url = self.management_url + url
resp, body = self.request(url, method, **kwargs) resp, body = self.request(url, method, **kwargs)
return resp, body return resp, body
except exceptions.BadRequest as e: except exceptions.BadRequest:
if attempts > self.retries: if attempts > self.retries:
raise raise
except exceptions.Unauthorized: except exceptions.Unauthorized:

View File

@ -118,10 +118,10 @@ class ShellTest(utils.TestCase):
def test_help(self): def test_help(self):
# Some expected help output, including microversioned commands # Some expected help output, including microversioned commands
required = [ required = [
'.*?^usage: ', r'.*?^usage: ',
'.*?(?m)^\s+create\s+Creates a volume.', r'.*?(?m)^\s+create\s+Creates a volume.',
'.*?(?m)^\s+summary\s+Get volumes summary.', r'.*?(?m)^\s+summary\s+Get volumes summary.',
'.*?(?m)^Run "cinder help SUBCOMMAND" for help on a subcommand.', r'.*?(?m)^Run "cinder help SUBCOMMAND" for help on a subcommand.',
] ]
help_text = self.shell('help') help_text = self.shell('help')
for r in required: for r in required:
@ -130,8 +130,8 @@ class ShellTest(utils.TestCase):
def test_help_on_subcommand(self): def test_help_on_subcommand(self):
required = [ required = [
'.*?^usage: cinder list', r'.*?^usage: cinder list',
'.*?(?m)^Lists all volumes.', r'.*?(?m)^Lists all volumes.',
] ]
help_text = self.shell('help list') help_text = self.shell('help list')
for r in required: for r in required:
@ -140,8 +140,8 @@ class ShellTest(utils.TestCase):
def test_help_on_subcommand_mv(self): def test_help_on_subcommand_mv(self):
required = [ required = [
'.*?^usage: cinder summary', r'.*?^usage: cinder summary',
'.*?(?m)^Get volumes summary.', r'.*?(?m)^Get volumes summary.',
] ]
help_text = self.shell('help summary') help_text = self.shell('help summary')
for r in required: for r in required:

View File

@ -33,60 +33,61 @@ def _get_default_RateLimit(verb="verb1", uri="uri1", regex="regex1",
class TestLimits(utils.TestCase): class TestLimits(utils.TestCase):
def test_repr(self): def test_repr(self):
l = limits.Limits(None, {"foo": "bar"}, resp=REQUEST_ID) limit = limits.Limits(None, {"foo": "bar"}, resp=REQUEST_ID)
self.assertEqual("<Limits>", repr(l)) self.assertEqual("<Limits>", repr(limit))
self._assert_request_id(l) self._assert_request_id(limit)
def test_absolute(self): def test_absolute(self):
l = limits.Limits(None, limit = limits.Limits(
{"absolute": {"name1": "value1", "name2": "value2"}}, None,
resp=REQUEST_ID) {"absolute": {"name1": "value1", "name2": "value2"}},
resp=REQUEST_ID)
l1 = limits.AbsoluteLimit("name1", "value1") l1 = limits.AbsoluteLimit("name1", "value1")
l2 = limits.AbsoluteLimit("name2", "value2") l2 = limits.AbsoluteLimit("name2", "value2")
for item in l.absolute: for item in limit.absolute:
self.assertIn(item, [l1, l2]) self.assertIn(item, [l1, l2])
self._assert_request_id(l) self._assert_request_id(limit)
def test_rate(self): def test_rate(self):
l = limits.Limits(None, limit = limits.Limits(
{ None,
"rate": [ {
{ "rate": [
"uri": "uri1", {
"regex": "regex1", "uri": "uri1",
"limit": [ "regex": "regex1",
{ "limit": [
"verb": "verb1", {
"value": "value1", "verb": "verb1",
"remaining": "remain1", "value": "value1",
"unit": "unit1", "remaining": "remain1",
"next-available": "next1", "unit": "unit1",
}, "next-available": "next1",
], },
}, ],
{ },
"uri": "uri2", {
"regex": "regex2", "uri": "uri2",
"limit": [ "regex": "regex2",
{ "limit": [
"verb": "verb2", {
"value": "value2", "verb": "verb2",
"remaining": "remain2", "value": "value2",
"unit": "unit2", "remaining": "remain2",
"next-available": "next2", "unit": "unit2",
}, "next-available": "next2",
], },
}, ],
], }, ],
}, },
resp=REQUEST_ID) resp=REQUEST_ID)
l1 = limits.RateLimit("verb1", "uri1", "regex1", "value1", "remain1", l1 = limits.RateLimit("verb1", "uri1", "regex1", "value1", "remain1",
"unit1", "next1") "unit1", "next1")
l2 = limits.RateLimit("verb2", "uri2", "regex2", "value2", "remain2", l2 = limits.RateLimit("verb2", "uri2", "regex2", "value2", "remain2",
"unit2", "next2") "unit2", "next2")
for item in l.rate: for item in limit.rate:
self.assertIn(item, [l1, l2]) self.assertIn(item, [l1, l2])
self._assert_request_id(l) self._assert_request_id(limit)
class TestRateLimit(utils.TestCase): class TestRateLimit(utils.TestCase):

View File

@ -52,12 +52,12 @@ class AppendFilters(argparse.Action):
default=None, default=None,
help='Show enabled filters for specified resource. Default=None.') help='Show enabled filters for specified resource. Default=None.')
def do_list_filters(cs, args): def do_list_filters(cs, args):
"""List enabled filters. """List enabled filters.
Symbol '~' after filter key means it supports inexact filtering. Symbol '~' after filter key means it supports inexact filtering.
""" """
filters = cs.resource_filters.list(resource=args.resource) filters = cs.resource_filters.list(resource=args.resource)
shell_utils.print_resource_filter_list(filters) shell_utils.print_resource_filter_list(filters)
@utils.arg('--filters', @utils.arg('--filters',

View File

@ -12,7 +12,7 @@ fasteners==0.7.0
fixtures==3.0.0 fixtures==3.0.0
flake8==2.5.5 flake8==2.5.5
future==0.16.0 future==0.16.0
hacking==0.12.0 hacking==2.0.0
idna==2.6 idna==2.6
iso8601==0.1.11 iso8601==0.1.11
jsonschema==2.6.0 jsonschema==2.6.0

View File

@ -3,7 +3,7 @@
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
# Hacking already pins down pep8, pyflakes and flake8 # 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 coverage!=4.4,>=4.0 # Apache-2.0
ddt>=1.0.1 # MIT ddt>=1.0.1 # MIT
fixtures>=3.0.0 # Apache-2.0/BSD fixtures>=3.0.0 # Apache-2.0/BSD

View File

@ -71,5 +71,6 @@ def main(argv):
install.install_dependencies() install.install_dependencies()
print_help(project, venv, root) print_help(project, venv, root)
if __name__ == '__main__': if __name__ == '__main__':
main(sys.argv) main(sys.argv)

View File

@ -104,7 +104,7 @@ commands = {[testenv:functional]commands}
[flake8] [flake8]
show-source = True 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 exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
[testenv:lower-constraints] [testenv:lower-constraints]