Add test for no_translate_debug_logs hacking check
Adds a test for this hacking check. Also update the code (G319). Change-Id: I91996b94166f0e69ee4f5fc0b704118d59bfe841
This commit is contained in:
parent
3994eeb862
commit
a8151f1ba6
@ -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):
|
||||
|
@ -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"))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user