From 10814703f2cf02c949b4ba58f188e82e2aeae2cf Mon Sep 17 00:00:00 2001 From: junboli Date: Sat, 15 Jul 2017 12:50:29 +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: I33f4264ddf79067f75cd5ba87ea08286dd957dc2 --- mistral/tests/unit/lang/v2/test_workbook.py | 6 ++---- mistral/tests/unit/rpc/kombu/test_kombu_listener.py | 5 ++--- tox.ini | 3 +++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mistral/tests/unit/lang/v2/test_workbook.py b/mistral/tests/unit/lang/v2/test_workbook.py index fcf439f74..d74f6dffc 100644 --- a/mistral/tests/unit/lang/v2/test_workbook.py +++ b/mistral/tests/unit/lang/v2/test_workbook.py @@ -428,8 +428,7 @@ class WorkbookSpecValidation(base.WorkbookSpecValidationTestCase): for valid in valid_names: result = re.match(workbook.NON_VERSION_WORD_REGEX, valid) - self.assertNotEqual( - None, + self.assertIsNotNone( result, "Expected match for: {}".format(valid) ) @@ -440,8 +439,7 @@ class WorkbookSpecValidation(base.WorkbookSpecValidationTestCase): for invalid in invalid_names: result = re.match(workbook.NON_VERSION_WORD_REGEX, invalid) - self.assertEqual( - None, + self.assertIsNone( result, "Didn't expected match for: {}".format(invalid) ) diff --git a/mistral/tests/unit/rpc/kombu/test_kombu_listener.py b/mistral/tests/unit/rpc/kombu/test_kombu_listener.py index f3f08d985..53f42df03 100644 --- a/mistral/tests/unit/rpc/kombu/test_kombu_listener.py +++ b/mistral/tests/unit/rpc/kombu/test_kombu_listener.py @@ -65,9 +65,8 @@ class KombuListenerTestCase(base.KombuTestCase): self.listener.remove_listener(correlation_id) - self.assertEqual( - self.listener._results.get(correlation_id), - None + self.assertIsNone( + self.listener._results.get(correlation_id) ) def test_remove_listener_correlation_id_not_in_results(self): diff --git a/tox.ini b/tox.ini index b05caa27b..062bda058 100644 --- a/tox.ini +++ b/tox.ini @@ -75,6 +75,9 @@ whitelist_externals = rm ignore = D100,D101,D102,D103,D104,D105,D200,D203,D202,D204,D205,D208,D400,D401 show-source = true builtins = _ +# [H106] Don't put vim configuration in source files. +# [H203] Use assertIs(Not)None to check for None. +enable-extensions = H106,H203 exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools,scripts [hacking]