Remove hacking check N327

With mock 1.1.0+, mock will fail when nonexistent
methods are called, so this check is no longer
necessary.

Related-Bug: #1473454

Change-Id: I9cb8b4a5eab78e51728aa8f83668f5979c0b9be1
This commit is contained in:
Eric Harney 2015-07-10 10:25:50 -04:00
parent 0f588ac59b
commit ee6576c4eb
3 changed files with 0 additions and 23 deletions

View File

@ -12,7 +12,6 @@ Cinder Specific Commandments
- [N322] Ensure default arguments are not mutable.
- [N323] Add check for explicit import of _() to ensure proper translation.
- [N325] str() and unicode() cannot be used on an exception. Remove or use six.text_type().
- [N327] assert_called_once is not a valid Mock method.
- [N328] LOG.info messages require translations `_LI()`.
- [N329] LOG.exception and LOG.error messages require translations `_LE()`.
- [N330] LOG.warning messages require translations `_LW()`.

View File

@ -200,17 +200,6 @@ class CheckForStrUnicodeExc(BaseASTChecker):
super(CheckForStrUnicodeExc, self).generic_visit(node)
def check_assert_called_once(logical_line, filename):
msg = ("N327: assert_called_once is a no-op. please use assert_called_"
"once_with to test with explicit parameters or an assertEqual with"
" call_count.")
if 'cinder/tests/functional' or 'cinder/tests/unit' in filename:
pos = logical_line.find('.assert_called_once(')
if pos != -1:
yield (pos, msg)
def validate_log_translations(logical_line, filename):
# Translations are not required in the test directory.
# This will not catch all instances of violations, just direct
@ -324,7 +313,6 @@ def factory(register):
register(no_mutable_default_args)
register(check_explicit_underscore_import)
register(CheckForStrUnicodeExc)
register(check_assert_called_once)
register(check_oslo_namespace_imports)
register(check_datetime_now)
register(check_timeutils_strtime)

View File

@ -221,16 +221,6 @@ class HackingTestCase(test.TestCase):
self.assertEqual(1, len(list(checks.no_mutable_default_args(
"def foo (bar={}):"))))
def test_check_assert_called_once(self):
self.assertEqual(0, len(list(checks.check_assert_called_once(
".assert_called_with(", "cinder/tests/unit/test1.py"))))
self.assertEqual(0, len(list(checks.check_assert_called_once(
".assert_called_with(", "cinder/blah.py"))))
self.assertEqual(1, len(list(checks.check_assert_called_once(
".assert_called_once(", "cinder/tests/unit/test1.py"))))
self.assertEqual(0, len(list(checks.check_assert_called_once(
".assertEqual(", "cinder/tests/unit/test1.py"))))
def test_oslo_namespace_imports_check(self):
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
"from oslo.concurrency import foo"))))