]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Correct directories check for N327 hacking check
authorJay S. Bryant <jsbryant@us.ibm.com>
Fri, 1 May 2015 21:05:25 +0000 (16:05 -0500)
committerJay S. Bryant <jsbryant@us.ibm.com>
Fri, 1 May 2015 22:47:24 +0000 (17:47 -0500)
For some reason the N327 hacking heck was looking for
cinder.unit/tests and cinder.functional/tests in the filename
that is sent in for the hacking check.  This should be
cinder/tests/unit and cinder/tests/functional.

This concern was originally raised in this review:
https://review.openstack.org/175604

Change-Id: Ic3041d9e16b3707aaf42ff941206d24ec66ead2b

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

index 653a22a265af34208c82b34af89a01b05697cb3b..3f9b7409f55fd6ae44b31046c4eb6c3d57d5119e 100644 (file)
@@ -204,7 +204,7 @@ def check_assert_called_once(logical_line, filename):
            "once_with to test with explicit parameters or an assertEqual with"
            " call_count.")
 
-    if 'cinder.functional/tests/' or 'cinder.unit/tests' in filename:
+    if 'cinder/tests/functional' or 'cinder/tests/unit' in filename:
         pos = logical_line.find('.assert_called_once(')
         if pos != -1:
             yield (pos, msg)
index b9323f859e57a4bb1a27eef749b22b2aaaaa913d..da1048f7db5b8e19f9b334f0c052253ee2138635 100644 (file)
@@ -223,13 +223,13 @@ class HackingTestCase(test.TestCase):
 
     def test_check_assert_called_once(self):
         self.assertEqual(0, len(list(checks.check_assert_called_once(
-            ".assert_called_with(", "cinder.tests.unit/test1.py"))))
+            ".assert_called_with(", "cinder/tests/unit/test1.py"))))
         self.assertEqual(0, len(list(checks.check_assert_called_once(
             ".assert_called_with(", "cinder/blah.py"))))
         self.assertEqual(1, len(list(checks.check_assert_called_once(
-            ".assert_called_once(", "cinder.tests.unit/test1.py"))))
+            ".assert_called_once(", "cinder/tests/unit/test1.py"))))
         self.assertEqual(0, len(list(checks.check_assert_called_once(
-            ".assertEqual(", "cinder.tests.unit/test1.py"))))
+            ".assertEqual(", "cinder/tests/unit/test1.py"))))
 
     def test_oslo_namespace_imports_check(self):
         self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(