From 4f4c2772dab7061194c3512554a080ecfccff962 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 26 Jan 2024 01:07:12 +0900 Subject: [PATCH] Bump hacking (again) The previous attempt did not update the version in pre commit config so the old version is still used by pep8 target. Change-Id: Idf8c7d99f7c6aeb0244d58e85524ba1f039195d8 --- .pre-commit-config.yaml | 2 +- oslo_messaging/hacking/checks.py | 6 +++--- .../tests/drivers/test_amqp_driver.py | 18 ++++++++++-------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 50d8dea8c..9d615bf37 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: - id: flake8 name: flake8 additional_dependencies: - - hacking>=3.0.1,<=4.1.0 + - hacking>=6.1.0,<=6.2.0 language: python entry: flake8 files: '^.*\.py$' diff --git a/oslo_messaging/hacking/checks.py b/oslo_messaging/hacking/checks.py index 1241b249f..0b1a746e8 100644 --- a/oslo_messaging/hacking/checks.py +++ b/oslo_messaging/hacking/checks.py @@ -31,17 +31,17 @@ def check_oslo_namespace_imports(logical_line): msg = ("O321: '%s' must be used instead of '%s'.") % ( logical_line.replace('oslo.', 'oslo_'), logical_line) - yield(0, msg) + yield (0, msg) elif re.match(oslo_namespace_imports_from_root, logical_line): msg = ("O321: '%s' must be used instead of '%s'.") % ( logical_line.replace('from oslo import ', 'import oslo_'), logical_line) - yield(0, msg) + yield (0, msg) elif re.match(oslo_namespace_imports_dot, logical_line): msg = ("O321: '%s' must be used instead of '%s'.") % ( logical_line.replace('import', 'from').replace('.', ' import '), logical_line) - yield(0, msg) + yield (0, msg) class BaseASTChecker(ast.NodeVisitor): diff --git a/oslo_messaging/tests/drivers/test_amqp_driver.py b/oslo_messaging/tests/drivers/test_amqp_driver.py index f58a40d79..35aa53984 100644 --- a/oslo_messaging/tests/drivers/test_amqp_driver.py +++ b/oslo_messaging/tests/drivers/test_amqp_driver.py @@ -1530,26 +1530,27 @@ class TestMessageRetransmit(_AmqpBrokerTestCase): def test_released(self): # 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): # should retry and succeed - self._test_retransmit(lambda l, h: l.message_modified(h, - False, - False, - {})) + self._test_retransmit(lambda link, handle: + link.message_modified(handle, False, False, {})) def test_modified_failed(self): # since delivery_failed is set to True, should fail self.assertRaises(oslo_messaging.MessageDeliveryFailure, 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): # rejected - should fail self.assertRaises(oslo_messaging.MessageDeliveryFailure, self._test_retransmit, - lambda l, h: l.message_rejected(h, {})) + lambda link, handle: + link.message_rejected(handle, {})) @testtools.skipUnless(SSL_ENABLED, "OpenSSL not supported") @@ -2154,7 +2155,8 @@ class FakeBroker(threading.Thread): self.on_sender_active = lambda link: None self.on_receiver_active = 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): """Start the server."""