Merge "Bump hacking (again)"

This commit is contained in:
Zuul 2024-01-27 11:46:42 +00:00 committed by Gerrit Code Review
commit b5244bd05a
3 changed files with 14 additions and 12 deletions

View File

@ -32,7 +32,7 @@ repos:
- id: flake8 - id: flake8
name: flake8 name: flake8
additional_dependencies: additional_dependencies:
- hacking>=3.0.1,<=4.1.0 - hacking>=6.1.0,<=6.2.0
language: python language: python
entry: flake8 entry: flake8
files: '^.*\.py$' files: '^.*\.py$'

View File

@ -31,17 +31,17 @@ def check_oslo_namespace_imports(logical_line):
msg = ("O321: '%s' must be used instead of '%s'.") % ( msg = ("O321: '%s' must be used instead of '%s'.") % (
logical_line.replace('oslo.', 'oslo_'), logical_line.replace('oslo.', 'oslo_'),
logical_line) logical_line)
yield(0, msg) yield (0, msg)
elif re.match(oslo_namespace_imports_from_root, logical_line): elif re.match(oslo_namespace_imports_from_root, logical_line):
msg = ("O321: '%s' must be used instead of '%s'.") % ( msg = ("O321: '%s' must be used instead of '%s'.") % (
logical_line.replace('from oslo import ', 'import oslo_'), logical_line.replace('from oslo import ', 'import oslo_'),
logical_line) logical_line)
yield(0, msg) yield (0, msg)
elif re.match(oslo_namespace_imports_dot, logical_line): elif re.match(oslo_namespace_imports_dot, logical_line):
msg = ("O321: '%s' must be used instead of '%s'.") % ( msg = ("O321: '%s' must be used instead of '%s'.") % (
logical_line.replace('import', 'from').replace('.', ' import '), logical_line.replace('import', 'from').replace('.', ' import '),
logical_line) logical_line)
yield(0, msg) yield (0, msg)
class BaseASTChecker(ast.NodeVisitor): class BaseASTChecker(ast.NodeVisitor):

View File

@ -1530,26 +1530,27 @@ class TestMessageRetransmit(_AmqpBrokerTestCase):
def test_released(self): def test_released(self):
# should retry and succeed # should retry and succeed
self._test_retransmit(lambda l, h: l.message_released(h)) self._test_retransmit(lambda link, handle:
link.message_released(handle))
def test_modified(self): def test_modified(self):
# should retry and succeed # should retry and succeed
self._test_retransmit(lambda l, h: l.message_modified(h, self._test_retransmit(lambda link, handle:
False, link.message_modified(handle, False, False, {}))
False,
{}))
def test_modified_failed(self): def test_modified_failed(self):
# since delivery_failed is set to True, should fail # since delivery_failed is set to True, should fail
self.assertRaises(oslo_messaging.MessageDeliveryFailure, self.assertRaises(oslo_messaging.MessageDeliveryFailure,
self._test_retransmit, self._test_retransmit,
lambda l, h: l.message_modified(h, True, False, {})) lambda link, handle:
link.message_modified(handle, True, False, {}))
def test_rejected(self): def test_rejected(self):
# rejected - should fail # rejected - should fail
self.assertRaises(oslo_messaging.MessageDeliveryFailure, self.assertRaises(oslo_messaging.MessageDeliveryFailure,
self._test_retransmit, self._test_retransmit,
lambda l, h: l.message_rejected(h, {})) lambda link, handle:
link.message_rejected(handle, {}))
@testtools.skipUnless(SSL_ENABLED, "OpenSSL not supported") @testtools.skipUnless(SSL_ENABLED, "OpenSSL not supported")
@ -2154,7 +2155,8 @@ class FakeBroker(threading.Thread):
self.on_sender_active = lambda link: None self.on_sender_active = lambda link: None
self.on_receiver_active = lambda link: link.add_capacity(10) self.on_receiver_active = lambda link: link.add_capacity(10)
self.on_credit_exhausted = lambda link: link.add_capacity(10) self.on_credit_exhausted = lambda link: link.add_capacity(10)
self.on_message = lambda m, h, l: self.forward_message(m, h, l) self.on_message = lambda message, handle, link: self.forward_message(
message, handle, link)
def start(self): def start(self):
"""Start the server.""" """Start the server."""