From: Jay S. Bryant Date: Fri, 1 May 2015 21:05:25 +0000 (-0500) Subject: Correct directories check for N327 hacking check X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=4e1547a1c10a12ab17f285ce42a06db2c19b653f;p=openstack-build%2Fcinder-build.git Correct directories check for N327 hacking check 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 --- diff --git a/cinder/hacking/checks.py b/cinder/hacking/checks.py index 653a22a26..3f9b7409f 100644 --- a/cinder/hacking/checks.py +++ b/cinder/hacking/checks.py @@ -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) diff --git a/cinder/tests/unit/test_hacking.py b/cinder/tests/unit/test_hacking.py index b9323f859..da1048f7d 100644 --- a/cinder/tests/unit/test_hacking.py +++ b/cinder/tests/unit/test_hacking.py @@ -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(