From 23c9bad3bdfe7a1240790ccb18cb63ab5e244022 Mon Sep 17 00:00:00 2001 From: loooosy Date: Tue, 11 Jul 2017 10:43:43 +0800 Subject: [PATCH] Enable some off-by-default checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of the available checks are disabled by default, like: [H106] Don’t put vim configuration in source files [H203] Use assertIs(Not)None to check for None Change-Id: I380596faf23005e03a9a45f06cade5cb05837fb5 --- sushy/tests/unit/resources/system/test_system.py | 10 +++++----- tox.ini | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sushy/tests/unit/resources/system/test_system.py b/sushy/tests/unit/resources/system/test_system.py index 2bf879e0..b3c602f4 100644 --- a/sushy/tests/unit/resources/system/test_system.py +++ b/sushy/tests/unit/resources/system/test_system.py @@ -222,7 +222,7 @@ class SystemTestCase(base.TestCase): self.sys_inst._parse_attributes() # | THEN | self.assertEqual(96, self.sys_inst.memory_summary.size_gib) - self.assertEqual(None, self.sys_inst.memory_summary.health) + self.assertIsNone(self.sys_inst.memory_summary.health) # | GIVEN | self.sys_inst._json['MemorySummary'].pop('Status') @@ -230,22 +230,22 @@ class SystemTestCase(base.TestCase): self.sys_inst._parse_attributes() # | THEN | self.assertEqual(96, self.sys_inst.memory_summary.size_gib) - self.assertEqual(None, self.sys_inst.memory_summary.health) + self.assertIsNone(self.sys_inst.memory_summary.health) # | GIVEN | self.sys_inst._json['MemorySummary'].pop('TotalSystemMemoryGiB') # | WHEN | self.sys_inst._parse_attributes() # | THEN | - self.assertEqual(None, self.sys_inst.memory_summary.size_gib) - self.assertEqual(None, self.sys_inst.memory_summary.health) + self.assertIsNone(self.sys_inst.memory_summary.size_gib) + self.assertIsNone(self.sys_inst.memory_summary.health) # | GIVEN | self.sys_inst._json.pop('MemorySummary') # | WHEN | self.sys_inst._parse_attributes() # | THEN | - self.assertEqual(None, self.sys_inst.memory_summary) + self.assertIsNone(self.sys_inst.memory_summary) def test_processors(self): # check for the underneath variable value diff --git a/tox.ini b/tox.ini index c5ad819c..b1d9f856 100644 --- a/tox.ini +++ b/tox.ini @@ -40,8 +40,10 @@ commands = oslo_debug_helper {posargs} [flake8] # E123, E125 skipped as they are invalid PEP-8. - show-source = True ignore = E123,E125 +# H106: Don’t put vim configuration in source files +# H203: Use assertIs(Not)None to check for None +enable-extensions=H106,H203 builtins = _ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build