Merge "Move files to common lib(Part 4)"

This commit is contained in:
Jenkins 2015-01-12 12:47:47 +00:00 committed by Gerrit Code Review
commit 0f55aeee32
3 changed files with 10 additions and 9 deletions

View File

@ -12,7 +12,7 @@ Rally Specific Commandments
* [N302] - Ensure that nonexistent "assert_called" is not used
* [N303] - Ensure that nonexistent "assert_called_once" is not used
* [N310-N314] - Reserved for rules related to logging
* [N310] - Ensure that ``rally.log`` is used instead of ``rally.openstack.common.log``
* [N310] - Ensure that ``rally.common.log`` is used instead of ``rally.openstack.common.log``
* [N311] - Validate that debug level logs are not translated
* [N312] - Validate correctness of debug on check.
* [N32x] - Reserved for rules related to assert* methods

View File

@ -116,7 +116,7 @@ def check_import_of_logging(logical_line, filename):
N310
"""
excluded_files = ["./rally/log.py", "./tests/unit/test_log.py"]
excluded_files = ["./rally/common/log.py", "./tests/unit/test_log.py"]
forbidden_imports = ["from rally.openstack.common import log",
"import rally.openstack.common.log",
@ -126,7 +126,7 @@ def check_import_of_logging(logical_line, filename):
for forbidden_import in forbidden_imports:
if logical_line.startswith(forbidden_import):
yield (0, "N310 Wrong module for logging is imported. Please "
"use `rally.log` instead.")
"use `rally.common.log` instead.")
def no_translate_debug_logs(logical_line):
@ -156,12 +156,13 @@ def no_use_conf_debug_check(logical_line, filename):
N312
"""
excluded_files = ["./rally/log.py"]
excluded_files = ["./rally/common/log.py"]
point = logical_line.find("CONF.debug")
if point != -1 and filename not in excluded_files:
yield(point, "N312 Don't use `CONF.debug`. "
"Function `rally.log.is_debug` should be used instead.")
"Function `rally.common.log.is_debug` "
"should be used instead.")
def assert_true_instance(logical_line):

View File

@ -65,9 +65,9 @@ class HackingTestCase(test.TestCase):
bad_imports = ["from rally.openstack.common import log",
"import rally.openstack.common.log",
"import logging"]
good_imports = ["from rally import log",
"from rally.log",
"import rally.log"]
good_imports = ["from rally.common import log",
"from rally.common.log",
"import rally.common.log"]
for bad_import in bad_imports:
checkres = checks.check_import_of_logging(bad_import, "fakefile")
@ -75,7 +75,7 @@ class HackingTestCase(test.TestCase):
for bad_import in bad_imports:
checkres = checks.check_import_of_logging(bad_import,
"./rally/log.py")
"./rally/common/log.py")
self.assertEqual([], list(checkres))
for good_import in good_imports: