diff --git a/tests/hacking/README.rst b/tests/hacking/README.rst index e2bbe7c7..a158427b 100644 --- a/tests/hacking/README.rst +++ b/tests/hacking/README.rst @@ -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 diff --git a/tests/hacking/checks.py b/tests/hacking/checks.py index 7aea75f3..28e9d151 100644 --- a/tests/hacking/checks.py +++ b/tests/hacking/checks.py @@ -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): diff --git a/tests/unit/test_hacking.py b/tests/unit/test_hacking.py index 8442ac0e..3e42d4c9 100644 --- a/tests/unit/test_hacking.py +++ b/tests/unit/test_hacking.py @@ -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: