diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 08aef91b2..50d8dea8c 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,<3.1.0
+          - hacking>=3.0.1,<=4.1.0
         language: python
         entry: flake8
         files: '^.*\.py$'
diff --git a/oslo_messaging/tests/test_transport.py b/oslo_messaging/tests/test_transport.py
index 31fec16cd..cb12c16ea 100644
--- a/oslo_messaging/tests/test_transport.py
+++ b/oslo_messaging/tests/test_transport.py
@@ -115,7 +115,7 @@ class GetTransportTestCase(test_utils.BaseTestCase):
         self.assertIsNotNone(transport_)
         self.assertIs(transport_.conf, self.conf)
         self.assertIs(transport_._driver, drvr)
-        self.assertTrue(isinstance(transport_, transport.RPCTransport))
+        self.assertIsInstance(transport_, transport.RPCTransport)
 
         driver.DriverManager.assert_called_once_with('oslo.messaging.drivers',
                                                      self.expect['backend'],
diff --git a/test-requirements.txt b/test-requirements.txt
index 983c1c918..3a7c44fc7 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -3,7 +3,7 @@
 # process, which may cause wedges in the gate later.
 
 # Hacking already pins down pep8, pyflakes and flake8
-hacking>=3.0.1,<3.1.0 # Apache-2.0
+hacking>=3.0.1,<=4.1.0 # Apache-2.0
 
 fixtures>=3.0.0 # Apache-2.0/BSD
 stestr>=2.0.0 # Apache-2.0