Update hacking for Python3

The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Change-Id: I3062215fcfc2e448e0f29402104496f80945aeee
This commit is contained in:
Andreas Jaeger 2020-03-28 16:03:48 +01:00
parent 93811d1ab1
commit d7c3cb9799
9 changed files with 12 additions and 7 deletions

View File

@ -46,6 +46,7 @@ def process_jobs():
msg.delete() msg.delete()
time.sleep(0.5) time.sleep(0.5)
if __name__ == '__main__': if __name__ == '__main__':
while True: while True:
send_jobs() send_jobs()

View File

@ -25,5 +25,6 @@ def healthy():
cli = client.Client(url=URL, version=2) cli = client.Client(url=URL, version=2)
return True if cli.health() else False return True if cli.health() else False
if __name__ == '__main__': if __name__ == '__main__':
healthy() healthy()

View File

@ -44,6 +44,7 @@ def create_post_delete(queue_name, messages):
queue.delete() queue.delete()
if __name__ == '__main__': if __name__ == '__main__':
messages = [{'body': {'id': idx}, 'ttl': 360} messages = [{'body': {'id': idx}, 'ttl': 360}
for idx in range(20)] for idx in range(20)]

View File

@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# 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!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 hacking>=3.0,<3.1.0 # Apache-2.0
# Unit testing # Unit testing
fixtures>=3.0.0 # Apache-2.0/BSD fixtures>=3.0.0 # Apache-2.0/BSD

View File

@ -50,6 +50,8 @@ commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenote
[flake8] [flake8]
builtins = _ builtins = _
exclude = .venv,.git,.tox,dist,doc,*.egg exclude = .venv,.git,.tox,dist,doc,*.egg
# W504 line break after binary operator
ignore = W504
[testenv:lower-constraints] [testenv:lower-constraints]
deps = deps =

View File

@ -15,7 +15,7 @@
from oslo_i18n import * # noqa from oslo_i18n import * # noqa
_translators = TranslatorFactory(domain='zaqarclient') _translators = TranslatorFactory(domain='zaqarclient') # noqa: F405
# The primary translation function using the well-known name "_" # The primary translation function using the well-known name "_"
_ = _translators.primary _ = _translators.primary

View File

@ -476,7 +476,7 @@ class UpdatePool(command.ShowOne):
"""Update a pool attribute""" """Update a pool attribute"""
_description = _("Update a pool attribute") _description = _("Update a pool attribute")
log = logging.getLogger(__name__+".UpdatePool") log = logging.getLogger(__name__ + ".UpdatePool")
def get_parser(self, prog_name): def get_parser(self, prog_name):
parser = super(UpdatePool, self).get_parser(prog_name) parser = super(UpdatePool, self).get_parser(prog_name)
@ -648,7 +648,7 @@ class UpdateFlavor(command.ShowOne):
"""Update a flavor's attributes""" """Update a flavor's attributes"""
_description = _("Update a flavor's attributes") _description = _("Update a flavor's attributes")
log = logging.getLogger(__name__+".UpdateFlavor") log = logging.getLogger(__name__ + ".UpdateFlavor")
def get_parser(self, prog_name): def get_parser(self, prog_name):
parser = super(UpdateFlavor, self).get_parser(prog_name) parser = super(UpdateFlavor, self).get_parser(prog_name)

View File

@ -24,7 +24,7 @@ from zaqarclient.queues.v1 import message
# NOTE(wanghao): This is copied from Zaqar server side, so if server have # NOTE(wanghao): This is copied from Zaqar server side, so if server have
# updated it someday, we should update it here to keep consistent. # updated it someday, we should update it here to keep consistent.
QUEUE_NAME_REGEX = re.compile('^[a-zA-Z0-9_\-]+$') QUEUE_NAME_REGEX = re.compile(r'^[a-zA-Z0-9_\-]+$')
class Queue(object): class Queue(object):

View File

@ -102,6 +102,6 @@ class TestBase(testtools.TestCase):
If a group argument is supplied, the overrides are applied to If a group argument is supplied, the overrides are applied to
the specified configuration option group. the specified configuration option group.
""" """
parent = (group and self.conf.setdefault(group, {}) parent = (group and self.conf.setdefault(group, {}) or
or self.conf) self.conf)
parent.update(kw) parent.update(kw)