From 3855eaca276f61749ac9cca84ba88d5ff520e029 Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Wed, 11 Sep 2019 13:10:00 -0400 Subject: [PATCH] Move hacking checks to tests dir This is not cinder service code, would be better to move it into "tests". Change-Id: I7b18453269cfc57bfbc9bd143d72948e88e60836 --- .zuul.yaml | 4 ++-- cinder/{ => tests}/hacking/__init__.py | 0 cinder/{ => tests}/hacking/checks.py | 2 +- cinder/tests/unit/test_hacking.py | 4 ++-- tools/config/generate_cinder_opts.py | 2 +- tox.ini | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) rename cinder/{ => tests}/hacking/__init__.py (100%) rename cinder/{ => tests}/hacking/checks.py (99%) diff --git a/.zuul.yaml b/.zuul.yaml index 6e2c7fbf56a..2ca20779100 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -18,8 +18,8 @@ irrelevant-files: &functional-irrelevant-files - ^.*\.rst$ - ^api-ref/.*$ - - ^cinder/hacking/.*$ - ^cinder/locale/.*$ + - ^cinder/tests/hacking/.*$ - ^cinder/tests/unit.*$ - ^contrib/block-box.*$ - ^doc/.*$ @@ -38,9 +38,9 @@ - ^.*\.rst$ - ^api-ref/.*$ - ^cinder/cmd/status\.py$ - - ^cinder/hacking/.*$ - ^cinder/locale/.*$ - ^cinder/tests/functional.*$ + - ^cinder/tests/hacking/.*$ - ^cinder/tests/unit.*$ - ^contrib/block-box.*$ - ^doc/.*$ diff --git a/cinder/hacking/__init__.py b/cinder/tests/hacking/__init__.py similarity index 100% rename from cinder/hacking/__init__.py rename to cinder/tests/hacking/__init__.py diff --git a/cinder/hacking/checks.py b/cinder/tests/hacking/checks.py similarity index 99% rename from cinder/hacking/checks.py rename to cinder/tests/hacking/checks.py index 1a1cf8a38de..d8026e7b361 100644 --- a/cinder/hacking/checks.py +++ b/cinder/tests/hacking/checks.py @@ -27,7 +27,7 @@ Guidelines for writing new hacking checks on the N3xx value. - List the new rule in the top level HACKING.rst file - Add test cases for each new rule to - cinder/tests/test_hacking.py + cinder/tests/unit/test_hacking.py """ diff --git a/cinder/tests/unit/test_hacking.py b/cinder/tests/unit/test_hacking.py index e7f1be2f208..ed63a4fb497 100644 --- a/cinder/tests/unit/test_hacking.py +++ b/cinder/tests/unit/test_hacking.py @@ -18,13 +18,13 @@ import textwrap import mock import pycodestyle -from cinder.hacking import checks from cinder import test +from cinder.tests.hacking import checks @ddt.ddt class HackingTestCase(test.TestCase): - """This class tests the hacking checks in cinder.hacking.checks + """This class tests cinder's hacking checks. This class ensures that Cinder's hacking checks are working by passing strings to the check methods like the pep8/flake8 parser would. The parser diff --git a/tools/config/generate_cinder_opts.py b/tools/config/generate_cinder_opts.py index d786f106eb3..e24352a7423 100644 --- a/tools/config/generate_cinder_opts.py +++ b/tools/config/generate_cinder_opts.py @@ -106,7 +106,7 @@ if __name__ == "__main__": for atree in dir_trees_list: if atree in ["tools/config/generate_cinder_opts.py", - "cinder/hacking/checks.py", + "cinder/tests/hacking/checks.py", "cinder/volume/configuration.py", "cinder/test.py", "cinder/cmd/status.py"]: diff --git a/tox.ini b/tox.ini index 5cdb73afecd..afa710471a4 100644 --- a/tox.ini +++ b/tox.ini @@ -207,7 +207,7 @@ exclude = .git,.venv,.tox,dist,tools,doc/ext,*egg,build max-complexity=30 [hacking] -local-check-factory = cinder.hacking.checks.factory +local-check-factory = cinder.tests.hacking.checks.factory import_exceptions = cinder.i18n [doc8]