From 1dda708581d4c2cdf073ab290356eab16112300f Mon Sep 17 00:00:00 2001 From: "Jay S. Bryant" Date: Thu, 12 Mar 2015 10:06:23 -0500 Subject: [PATCH] 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 --- cinder/hacking/checks.py | 2 +- cinder/tests/test_hacking.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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")))) -- 2.45.2