flake8: Enable some off-by-default checks
Update test-requirements.txt to use latest versions of: * flake8-import-order * hacking Enable the following off-by-default checks: * [H204] Use assert(Not)Equal to check for equality. * [H205] Use assert(Greater|Less)(Equal) for comparison. Fix code that failed H204 and H205. In this case the fix was to add: # noqa As we want to ensure that these particular tests are calling the desired comparison operators. Change-Id: If9cba62c832e301ac81320f9142e91319f0e40a9
This commit is contained in:
parent
e9318c7574
commit
3700e7c6d5
@ -102,7 +102,7 @@ class TestVersion(base.BaseApiTest):
|
||||
self.assertTrue(hasattr(ver_1, '__eq__'))
|
||||
self.assertEqual(ver_1, ver_2)
|
||||
# Force __eq__ to be called and return False
|
||||
self.assertFalse(ver_1 == ver_3)
|
||||
self.assertFalse(ver_1 == ver_3) # noqa
|
||||
|
||||
def test_not_equals(self):
|
||||
ver_1 = cbase.Version(
|
||||
@ -114,7 +114,7 @@ class TestVersion(base.BaseApiTest):
|
||||
self.assertTrue(hasattr(ver_1, '__ne__'))
|
||||
self.assertNotEqual(ver_1, ver_3)
|
||||
# Force __ne__ to be called and return False
|
||||
self.assertFalse(ver_1 != ver_2)
|
||||
self.assertFalse(ver_1 != ver_2) # noqa
|
||||
|
||||
def test_greaterthan(self):
|
||||
ver_1 = cbase.Version(
|
||||
@ -124,7 +124,7 @@ class TestVersion(base.BaseApiTest):
|
||||
self.assertTrue(hasattr(ver_1, '__gt__'))
|
||||
self.assertGreater(ver_1, ver_2)
|
||||
# Force __gt__ to be called and return False
|
||||
self.assertFalse(ver_2 > ver_1)
|
||||
self.assertFalse(ver_2 > ver_1) # noqa
|
||||
|
||||
def test_lessthan(self):
|
||||
# __lt__ is created by @functools.total_ordering, make sure it exists
|
||||
@ -136,4 +136,4 @@ class TestVersion(base.BaseApiTest):
|
||||
self.assertTrue(hasattr(ver_1, '__lt__'))
|
||||
self.assertLess(ver_1, ver_2)
|
||||
# Force __lt__ to be called and return False
|
||||
self.assertFalse(ver_2 < ver_1)
|
||||
self.assertFalse(ver_2 < ver_1) # noqa
|
||||
|
@ -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!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
|
||||
hacking>=1.0.0 # Apache-2.0
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
doc8 # Apache-2.0
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
@ -19,7 +19,7 @@ testresources>=0.2.4 # Apache-2.0/BSD
|
||||
testscenarios>=0.4 # Apache-2.0/BSD
|
||||
WebTest>=2.0 # MIT
|
||||
bashate>=0.2 # Apache-2.0
|
||||
flake8-import-order==0.11 # LGPLv3
|
||||
flake8-import-order>=0.13 # LGPLv3
|
||||
|
||||
# Doc requirements
|
||||
sphinx>=1.6.2 # BSD
|
||||
|
4
tox.ini
4
tox.ini
@ -104,8 +104,10 @@ application-import-names = ironic
|
||||
max-complexity=17
|
||||
# [H106] Don’t put vim configuration in source files.
|
||||
# [H203] Use assertIs(Not)None to check for None.
|
||||
# [H204] Use assert(Not)Equal to check for equality.
|
||||
# [H205] Use assert(Greater|Less)(Equal) for comparison.
|
||||
# [H904] Delay string interpolations at logging calls.
|
||||
enable-extensions=H106,H203,H904
|
||||
enable-extensions=H106,H203,H204,H205,H904
|
||||
|
||||
[hacking]
|
||||
import_exceptions = testtools.matchers, ironic.common.i18n
|
||||
|
Loading…
x
Reference in New Issue
Block a user