diff --git a/HACKING.rst b/HACKING.rst index 769150e6bb..466ea8649c 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -10,7 +10,6 @@ Manila Specific Commandments ---------------------------- - [M310] Check for improper use of logging format arguments. -- [M312] Use assertIsNone(...) instead of assertEqual(None, ...). - [M313] Use assertTrue(...) rather than assertEqual(True, ...). - [M323] Ensure that the _() function is explicitly imported to ensure proper translations. - [M325] str() and unicode() cannot be used on an exception. Remove or use six.text_type(). diff --git a/manila/hacking/checks.py b/manila/hacking/checks.py index 91a25f9b4f..4530b27cad 100644 --- a/manila/hacking/checks.py +++ b/manila/hacking/checks.py @@ -51,7 +51,6 @@ oslo_namespace_imports = re.compile(r"from[\s]*oslo[.](.*)") dict_constructor_with_list_copy_re = re.compile(r".*\bdict\((\[)?(\(|\[)") assert_no_xrange_re = re.compile(r"\s*xrange\s*\(") assert_True = re.compile(r".*assertEqual\(True, .*\)") -assert_None = re.compile(r".*assertEqual\(None, .*\)") no_log_warn = re.compile(r"\s*LOG.warn\(.*") @@ -290,13 +289,6 @@ def validate_assertTrue(logical_line): yield(0, msg) -def validate_assertIsNone(logical_line): - if re.match(assert_None, logical_line): - msg = ("M312: Unit tests should use assertIsNone(value) instead" - " of using assertEqual(None, value).") - yield(0, msg) - - def check_uuid4(logical_line): """Generating UUID @@ -338,6 +330,5 @@ def factory(register): register(dict_constructor_with_list_copy) register(no_xrange) register(validate_assertTrue) - register(validate_assertIsNone) register(check_uuid4) register(no_log_warn_check) diff --git a/manila/tests/test_hacking.py b/manila/tests/test_hacking.py index 50dd9e4b27..6666bb5047 100644 --- a/manila/tests/test_hacking.py +++ b/manila/tests/test_hacking.py @@ -314,13 +314,6 @@ class HackingTestCase(test.TestCase): self.assertEqual(1, len(list(checks.validate_assertTrue( "assertEqual(True, %s)" % test_value)))) - def test_validate_assertIsNone(self): - test_value = None - self.assertEqual(0, len(list(checks.validate_assertIsNone( - "assertIsNone(None)")))) - self.assertEqual(1, len(list(checks.validate_assertIsNone( - "assertEqual(None, %s)" % test_value)))) - def test_check_uuid4(self): code = """ fake_uuid = uuid.uuid4()