From: Jay S. Bryant Date: Thu, 12 Mar 2015 15:06:23 +0000 (-0500) Subject: Update hacking check for oslo_log X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=1dda708581d4c2cdf073ab290356eab16112300f;p=openstack-build%2Fcinder-build.git Update hacking check for oslo_log 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 --- diff --git a/cinder/hacking/checks.py b/cinder/hacking/checks.py index 5f44b7f47..cb27afe0b 100644 --- a/cinder/hacking/checks.py +++ b/cinder/hacking/checks.py @@ -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): diff --git a/cinder/tests/test_hacking.py b/cinder/tests/test_hacking.py index 3dbb22e76..8457b0720 100644 --- a/cinder/tests/test_hacking.py +++ b/cinder/tests/test_hacking.py @@ -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"))))