]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Update hacking check for oslo_log
authorJay S. Bryant <jsbryant@us.ibm.com>
Thu, 12 Mar 2015 15:06:23 +0000 (10:06 -0500)
committerJay S. Bryant <jsbryant@us.ibm.com>
Thu, 12 Mar 2015 15:09:44 +0000 (10:09 -0500)
With commit 5980da5d we moved Cinder to using the olso.log
library.  We also moved to the new oslo_log namespace.  With that
change we should have also updated the hacking checks to include
looking for old uses of oslo.log.

This change adds the necessary hacking check.

Change-Id: I6a5d4b66d3258dbd01543be03810a8f84040e660

cinder/hacking/checks.py
cinder/tests/test_hacking.py

index 5f44b7f47c26a3e56392f9d83c8b8d832f32aa71..cb27afe0b44b095979d8680982fedd82622e767f 100644 (file)
@@ -45,7 +45,7 @@ no_audit_log = re.compile(r"(.)*LOG\.audit(.)*")
 # NOTE(jsbryant): When other oslo libraries switch over non-namespaced
 # imports, we will need to add them to the regex below.
 oslo_namespace_imports = re.compile(r"from[\s]*oslo[.](concurrency|db"
-                                    "|config|utils|serialization)")
+                                    "|config|utils|serialization|log)")
 
 
 def no_vi_headers(physical_line, line_number, lines):
index 3dbb22e764b04dfdb206f83a79a0d213323ccaca..8457b07206f301e6981c7c565f149aa598a47025 100644 (file)
@@ -159,3 +159,7 @@ class HackingTestCase(test.TestCase):
             "from oslo.serialization import foo"))))
         self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
             "from oslo_serialization import bar"))))
+        self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
+            "from oslo.log import foo"))))
+        self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
+            "from oslo_log import bar"))))