summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-06-10 10:15:28 +0000
committerGerrit Code Review <review@openstack.org>2014-06-10 10:15:28 +0000
commit9c87169c78a01f7c057734f641d428a8804334f9 (patch)
tree1b17fd7e1892ab93ffc8ff3c8efb916a4b2d4440
parent6b2196151499456219c6d82ffe28b98d50eb8c95 (diff)
parenta8151f1ba6138fd089456a680ea709d38f5eb482 (diff)
downloadglance-2014.2.b1.tar.gz
Merge "Add test for no_translate_debug_logs hacking check"2014.2.b1
-rw-r--r--glance/hacking/checks.py2
-rw-r--r--glance/tests/test_hacking.py10
2 files changed, 11 insertions, 1 deletions
diff --git a/glance/hacking/checks.py b/glance/hacking/checks.py
index 8f00eba03..c03ac4bcc 100644
--- a/glance/hacking/checks.py
+++ b/glance/hacking/checks.py
@@ -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):
diff --git a/glance/tests/test_hacking.py b/glance/tests/test_hacking.py
index 5cf875a6c..dbad0f6e5 100644
--- a/glance/tests/test_hacking.py
+++ b/glance/tests/test_hacking.py
@@ -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"))))