Raise hacking version to 2.0.0

We've kept hacking capped for a long time now. This raises the hacking
package version to the latest release and fixes the issues that it
found.

Change-Id: I69e41a340c815090f25677607e971a8e75791f6d
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2019-12-21 03:27:48 -06:00
parent d240091c32
commit ced267b1d5
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
9 changed files with 63 additions and 63 deletions

View File

@ -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():

View File

@ -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:

View File

@ -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:

View File

@ -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("<Limits>", repr(l))
self._assert_request_id(l)
limit = limits.Limits(None, {"foo": "bar"}, resp=REQUEST_ID)
self.assertEqual("<Limits>", 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):

View File

@ -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',

View File

@ -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

View File

@ -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

View File

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

View File

@ -94,7 +94,7 @@ passenv = OS_*
[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]