Bump hacking

hacking 3.0.x is really old. Let's bump it to the latest version
available.

This also fixes some errors detected but some rules are excluded now.
See the comments in tox.ini for further details.

Change-Id: I2565e5f5e791dfdd9bbc1890b35c413965d83626
This commit is contained in:
Takashi Kajinami 2024-01-17 01:53:43 +09:00
parent 27689c9ce5
commit c69701eb73
9 changed files with 14 additions and 12 deletions

View File

@ -53,7 +53,7 @@ RESOURCE_NAME = bgpvpn.RESOURCE_NAME
COLLECTION_NAME = bgpvpn.COLLECTION_NAME
LOCAL_PREF_KEY = 'local_pref'
LOCAL_PREF_RANGE = [0, 2**32-1] # RFC 4271, section 4.3 (p.18)
LOCAL_PREF_RANGE = [0, 2**32 - 1] # RFC 4271, section 4.3 (p.18)
RESOURCE_ATTRIBUTE_MAP = {
COLLECTION_NAME: {

View File

@ -124,7 +124,7 @@ def check_no_contextlib_nested(logical_line, filename):
"more information.")
if contextlib_nested.match(logical_line):
yield(0, msg)
yield (0, msg)
@core.flake8ext

View File

@ -960,12 +960,12 @@ class TestAttributeValidation(base.BaseTestCase):
items = [['a', 'b'], ['c', 'd'], ['a', 'b']]
msg = validators._validate_list_of_items(mock.Mock(), items)
error = "Duplicate items in the list: '%s'" % ['a', 'b']
error = "Duplicate items in the list: '%s'" % str(['a', 'b'])
self.assertEqual(error, msg)
items = [{'a': 'b'}, {'c': 'd'}, {'a': 'b'}]
msg = validators._validate_list_of_items(mock.Mock(), items)
error = "Duplicate items in the list: '%s'" % {'a': 'b'}
error = "Duplicate items in the list: '%s'" % str({'a': 'b'})
self.assertEqual(error, msg)
def test_validate_dict_type(self):

View File

@ -28,7 +28,7 @@ class EventPayloadTestCase(base.BaseTestCase):
self.assertEqual(meta, e.metadata)
event_meta = e.metadata
event_meta['k3'] = 'v3'
self.assertTrue('k3' in e.metadata)
self.assertIn('k3', e.metadata)
def test_request_body(self):
e = events.EventPayload(mock.ANY, request_body={'k', 'v'})

View File

@ -31,7 +31,7 @@ class HackingTestCase(base.BaseTestCase):
def _reg(check_fn):
self.assertTrue(hasattr(check_fn, '__call__'))
self.assertFalse(check_fn in check_fns)
self.assertNotIn(check_fn, check_fns)
check_fns.append(check_fn)
factory(_reg)

View File

@ -810,7 +810,7 @@ class TestPlacementAPIClient(base.BaseTestCase):
def test_update_qos_allocation_other_conflict(self):
mock_rsp_get = self._get_allocation_response(
{RESOURCE_PROVIDER_UUID: {'c': 3}})
self.placement_fixture.mock_get.side_effect = 10*[mock_rsp_get]
self.placement_fixture.mock_get.side_effect = 10 * [mock_rsp_get]
mock_rsp_put = mock.Mock()
mock_rsp_put.text = ''
mock_rsp_put.json = lambda: {

View File

@ -1,6 +1,3 @@
# Requirements lower bounds listed here are our best effort to keep them up to
# date but we do not test them so no guarantee of having them all correct. If
# you find any incorrect lower bounds, let us know or propose a fix.
pbr>=4.0.0 # Apache-2.0
SQLAlchemy>=1.2.0 # MIT

View File

@ -1,10 +1,10 @@
hacking>=3.0.1,<3.1.0 # Apache-2.0
hacking>=6.1.0,<6.2.0 # Apache-2.0
bandit!=1.6.0,>=1.1.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
flake8-import-order==0.12 # LGPLv3
flake8-import-order>=0.18.0,<0.19.0 # LGPLv3
pylint>=2.2.0 # GPLv2
isort==4.3.21 # MIT
python-subunit>=1.0.0 # Apache-2.0/BSD

View File

@ -95,6 +95,11 @@ commands = oslo_debug_helper -t neutron_lib/tests/unit {posargs}
# H205: Use assert(Greater|Less)(Equal) for comparison
# H904: Delay string interpolations at logging calls
enable-extensions = H106,H203,H204,H205,H904
# Most of the whitespace related rules (E12* and E131) are excluded.
# W504 skipped because it conflicts with W503
# I202 skipped because it does not allow newline between 3rd party libraries
# import and neutron-lib code import, which is wrong
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,W504,I202
show-source = True
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools
import-order-style = pep8