Bump to hacking 2.x

This allows us to use a new version of flake8 that supports Python
3-only syntax. Existing issues are resolved.

Change-Id: I5de7e5cde6a5260f4e7e57586952256b59d3756d
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2020-02-07 11:39:24 +00:00 committed by Dan Smith
parent da7cd17a2b
commit 298c5107eb
5 changed files with 7 additions and 6 deletions

View File

@ -40,6 +40,7 @@ class IOTLightbulb(base.VersionedObject):
'manufactured_on': obj_fields.DateTimeField(),
}
# Now do some basic operations on a light bulb.
bulb = IOTLightbulb(serial='abc-123', manufactured_on=datetime.now())
print("The __str__() output of this new object: %s" % bulb)

View File

@ -1255,8 +1255,7 @@ class CoercedList(CoercedCollectionMixin, list):
super(CoercedList, self).append(self._coerce_item(len(self) + 1, x))
def extend(self, t):
l = len(self)
coerced_items = [self._coerce_item(l + index, item)
coerced_items = [self._coerce_item(len(self) + index, item)
for index, item in enumerate(t)]
super(CoercedList, self).extend(coerced_items)
@ -1264,8 +1263,7 @@ class CoercedList(CoercedCollectionMixin, list):
super(CoercedList, self).insert(i, self._coerce_item(i, x))
def __iadd__(self, y):
l = len(self)
coerced_items = [self._coerce_item(l + index, item)
coerced_items = [self._coerce_item(len(self) + index, item)
for index, item in enumerate(y)]
return super(CoercedList, self).__iadd__(coerced_items)

View File

@ -95,6 +95,7 @@ def _patch_mock_to_raise_for_invalid_assert_calls():
mock.Mock.__getattr__ = raise_for_invalid_assert_calls(
mock.Mock.__getattr__)
# NOTE(gibi): needs to be called only once at import time
# to patch the mock lib
_patch_mock_to_raise_for_invalid_assert_calls()

View File

@ -1,7 +1,7 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=1.1.0,<1.2.0 # Apache-2.0
hacking>=2.0.0,<2.1.0 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0
testtools>=2.2.0 # MIT
coverage!=4.4,>=4.0 # Apache-2.0

View File

@ -46,8 +46,9 @@ deps =
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
# W504 skipped as you must choose this or W503
show-source = True
ignore = E123,E125
ignore = E123,E125,W504
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build