From de5977d5b5c94bb732f6c86d10d5c12fac7973b0 Mon Sep 17 00:00:00 2001 From: "ChangBo Guo(gcb)" Date: Mon, 9 May 2016 17:42:06 +0800 Subject: [PATCH] Remove openstack/common related stuff openstack/common directory was used to keep files from oslo-incubator. There is no file from oslo-incubator now, so don't need handle particular case for openstack/common. Note: method split_path will be merged in oslo.utils[1], then we can remove this directory forever. [1] https://review.openstack.org/#/c/313996/ Change-Id: I60628204f928753ad930c0a2da631473c7f4fdc3 --- .coveragerc | 1 - run_tests.sh | 2 +- sahara/tests/unit/utils/test_hacking.py | 3 --- sahara/utils/hacking/checks.py | 4 ---- sahara/utils/hacking/logging_checks.py | 16 ++++++---------- sahara/utils/procutils.py | 2 +- tools/lintstack.py | 5 ----- tox.ini | 2 +- 8 files changed, 9 insertions(+), 26 deletions(-) diff --git a/.coveragerc b/.coveragerc index f96b7128..1e3cd115 100644 --- a/.coveragerc +++ b/.coveragerc @@ -2,7 +2,6 @@ branch = True source = sahara omit = - */openstack/common/* .tox/* sahara/tests/* diff --git a/run_tests.sh b/run_tests.sh index 3a23eacd..951ab9cb 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -157,5 +157,5 @@ fi if [ $coverage -eq 1 ]; then echo "Generating coverage report in covhtml/" ${wrapper} coverage combine - ${wrapper} coverage html --include='sahara/*' --omit='sahara/openstack/common/*' -d covhtml -i + ${wrapper} coverage html --include='sahara/*' -d covhtml -i fi diff --git a/sahara/tests/unit/utils/test_hacking.py b/sahara/tests/unit/utils/test_hacking.py index 4cf739d1..4bce6474 100644 --- a/sahara/tests/unit/utils/test_hacking.py +++ b/sahara/tests/unit/utils/test_hacking.py @@ -57,9 +57,6 @@ class HackingTestCase(testtools.TestCase): "from oslo_serialization import jsonutils as json", "path")))) self.assertEqual(0, len(list(checks.use_jsonutils( "import jsonschema", "path")))) - self.assertEqual(0, len(list(checks.use_jsonutils( - "import json", "sahara/openstack/common/utils.py")))) - self.assertEqual(1, len(list(checks.use_jsonutils( "import json", "path")))) self.assertEqual(1, len(list(checks.use_jsonutils( diff --git a/sahara/utils/hacking/checks.py b/sahara/utils/hacking/checks.py index 037e5cc6..6c1922cc 100644 --- a/sahara/utils/hacking/checks.py +++ b/sahara/utils/hacking/checks.py @@ -105,10 +105,6 @@ def use_jsonutils(logical_line, filename): """ if pep8.noqa(logical_line): return - ignore_dirs = ["sahara/openstack/common"] - for dir in ignore_dirs: - if dir in filename: - return invalid_line = re.compile(r"(import\s+json)") valid_line = re.compile(r"(import\s+jsonschema)") if (re.match(invalid_line, logical_line) and diff --git a/sahara/utils/hacking/logging_checks.py b/sahara/utils/hacking/logging_checks.py index 047f7665..0b41cc12 100644 --- a/sahara/utils/hacking/logging_checks.py +++ b/sahara/utils/hacking/logging_checks.py @@ -42,13 +42,11 @@ def validate_log_translations(logical_line, filename): """ # NOTE(Kezar): sahara/tests included because we don't require translations - # in tests. sahara/openstack/common included because it's part imported - # from oslo and we don't change it forever and ever. sahara/db/templates - # provide separate cli interface so we don't want to translate it. + # in tests. sahara/db/templates provide separate cli interface so we don't + # want to translate it. ignore_dirs = ["sahara/db/templates", - "sahara/tests", - "sahara/openstack/common"] + "sahara/tests"] for directory in ignore_dirs: if directory in filename: return @@ -98,13 +96,11 @@ def accepted_log_levels(logical_line, filename): """ # NOTE(Kezar): sahara/tests included because we don't require translations - # in tests. sahara/openstack/common included because it's part imported - # from oslo and we don't change it forever and ever. sahara/db/templates - # provide separate cli interface so we don't want to translate it. + # in tests. sahara/db/templates provide separate cli interface so we don't + # want to translate it. ignore_dirs = ["sahara/db/templates", - "sahara/tests", - "sahara/openstack/common"] + "sahara/tests"] for directory in ignore_dirs: if directory in filename: return diff --git a/sahara/utils/procutils.py b/sahara/utils/procutils.py index d652e67c..9be2b84c 100644 --- a/sahara/utils/procutils.py +++ b/sahara/utils/procutils.py @@ -58,7 +58,7 @@ def run_in_subprocess(proc, func, args=None, kwargs=None, interactive=False): return result['output'] finally: - # NOTE(dmitryme): in openstack/common/processutils.py it + # NOTE(dmitryme): in oslo.concurrency's file processutils.py it # is suggested to sleep a little between calls to multiprocessing. # That should allow it make some necessary cleanup context.sleep(0) diff --git a/tools/lintstack.py b/tools/lintstack.py index 5d2d58d7..e3cc7d6f 100755 --- a/tools/lintstack.py +++ b/tools/lintstack.py @@ -32,9 +32,6 @@ ignore_codes = ["E1103"] # Note(maoy): the error message is the pattern of E0202. It should be ignored # for sahara.tests modules ignore_messages = ["An attribute affected in sahara.tests"] -# We ignore all errors in openstack.common because it should be checked -# elsewhere. -ignore_modules = ["sahara/openstack/common/"] KNOWN_PYLINT_EXCEPTIONS_FILE = "tools/pylint_exceptions" @@ -88,8 +85,6 @@ class LintOutput(object): def is_ignored(self): if self.code in ignore_codes: return True - if any(self.filename.startswith(name) for name in ignore_modules): - return True if any(msg in self.message for msg in ignore_messages): return True return False diff --git a/tox.ini b/tox.ini index 38520dbc..2ef63f32 100644 --- a/tox.ini +++ b/tox.ini @@ -83,7 +83,7 @@ commands = bandit -c bandit.yaml -r sahara -n5 -p sahara_default -x tests [flake8] show-source = true builtins = _ -exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools +exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools [hacking] import_exceptions = sahara.i18n._, sahara.i18n._LI, sahara.i18n._LW, sahara.i18n._LE, sahara.i18n._LC