Merge "Fix the duplicate hacking check M312 and H203"

This commit is contained in:
Jenkins 2017-08-14 00:05:43 +00:00 committed by Gerrit Code Review
commit 33b5a72f94
3 changed files with 0 additions and 17 deletions

View File

@ -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().

View File

@ -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)

View File

@ -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()