Merge "Add test for no_translate_debug_logs hacking check"

This commit is contained in:
Jenkins 2014-06-10 10:15:28 +00:00 committed by Gerrit Code Review
commit 9c87169c78
2 changed files with 11 additions and 1 deletions

View File

@ -88,7 +88,7 @@ def no_translate_debug_logs(logical_line, filename):
if max([name in filename for name in dirs]):
if logical_line.startswith("LOG.debug(_("):
yield(0, "N319: Don't translate debug level logs")
yield(0, "G319: Don't translate debug level logs")
def factory(register):

View File

@ -41,3 +41,13 @@ class HackingTestCase(utils.BaseTestCase):
self.assertEqual(
0, len(list(checks.assert_equal_none("self.assertIsNone()"))))
def test_no_translate_debug_logs(self):
self.assertEqual(1, len(list(checks.no_translate_debug_logs(
"LOG.debug(_('foo'))", "glance/store/foo.py"))))
self.assertEqual(0, len(list(checks.no_translate_debug_logs(
"LOG.debug('foo')", "glance/store/foo.py"))))
self.assertEqual(0, len(list(checks.no_translate_debug_logs(
"LOG.info(_('foo'))", "glance/store/foo.py"))))