diff --git a/nova/hacking/checks.py b/nova/hacking/checks.py index b4a477adcadc..886547c51180 100644 --- a/nova/hacking/checks.py +++ b/nova/hacking/checks.py @@ -311,28 +311,6 @@ def no_setting_conf_directly_in_tests(logical_line, filename): "forbidden. Use self.flags(option=value) instead") -def validate_log_translations(logical_line, physical_line, filename): - # Translations are not required in the test directory - # and the Xen utilities - if ("nova/tests" in filename or - "plugins/xenserver/xenapi/etc/xapi.d" in filename): - return - if pep8.noqa(physical_line): - return - msg = "N328: LOG.info messages require translations `_LI()`!" - if log_translation_info.match(logical_line): - yield (0, msg) - msg = "N329: LOG.exception messages require translations `_LE()`!" - if log_translation_exception.match(logical_line): - yield (0, msg) - msg = "N330: LOG.warning, LOG.warn messages require translations `_LW()`!" - if log_translation_LW.match(logical_line): - yield (0, msg) - msg = "N321: Log messages require translations!" - if log_translation.match(logical_line): - yield (0, msg) - - def no_mutable_default_args(logical_line): msg = "N322: Method's default argument shouldn't be mutable!" if mutable_default_args.match(logical_line): @@ -846,7 +824,6 @@ def factory(register): register(assert_raises_regexp) register(no_translate_debug_logs) register(no_setting_conf_directly_in_tests) - register(validate_log_translations) register(no_mutable_default_args) register(check_explicit_underscore_import) register(use_jsonutils) diff --git a/nova/tests/unit/test_hacking.py b/nova/tests/unit/test_hacking.py index aa138404fc0d..47b4ce518f0f 100644 --- a/nova/tests/unit/test_hacking.py +++ b/nova/tests/unit/test_hacking.py @@ -208,32 +208,6 @@ class HackingTestCase(test.NoDBTestCase): self.assertEqual(len(list(checks.no_setting_conf_directly_in_tests( "CONF.option = 1", "nova/compute/foo.py"))), 0) - def test_log_translations(self): - logs = ['audit', 'error', 'info', 'warning', 'critical', 'warn', - 'exception'] - levels = ['_LI', '_LW', '_LE', '_LC'] - debug = "LOG.debug('OK')" - self.assertEqual( - 0, len(list(checks.validate_log_translations(debug, debug, 'f')))) - for log in logs: - bad = 'LOG.%s("Bad")' % log - self.assertEqual(1, - len(list( - checks.validate_log_translations(bad, bad, 'f')))) - ok = "LOG.%s('OK') # noqa" % log - self.assertEqual(0, - len(list( - checks.validate_log_translations(ok, ok, 'f')))) - ok = "LOG.%s(variable)" % log - self.assertEqual(0, - len(list( - checks.validate_log_translations(ok, ok, 'f')))) - for level in levels: - ok = "LOG.%s(%s('OK'))" % (log, level) - self.assertEqual(0, - len(list( - checks.validate_log_translations(ok, ok, 'f')))) - def test_no_mutable_default_args(self): self.assertEqual(1, len(list(checks.no_mutable_default_args( "def get_info_from_bdm(virt_type, bdm, mapping=[])"))))