summaryrefslogtreecommitdiff
path: root/tempest/hacking
diff options
context:
space:
mode:
authorMatthew Treinish <mtreinish@kortar.org>2016-05-31 23:42:55 -0400
committerMatthew Treinish <mtreinish@kortar.org>2016-06-01 15:05:59 -0400
commit59d9eaabddba4867c76af39f656c9f2ae1e083b7 (patch)
tree01844064d540d6363af5f6ef8c5b4624ac96c994 /tempest/hacking
parentaff9cc072bbbb222b09a3411b203c180b493eae8 (diff)
downloadtempest-59d9eaabddba4867c76af39f656c9f2ae1e083b7.tar.gz
Add hacking rule to enfore no config in tempest.lib
This commit adds a hacking rule to enforce that we never add a config dependency on tempest/lib. Right now we're completely dependent on reviewers catching this, it is a strong rule so we should ensure we can't ever land a change that does this. Change-Id: I1ab1ba52573c6706a50abcd021759c93dd19aa44
Diffstat (limited to 'tempest/hacking')
-rw-r--r--tempest/hacking/checks.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tempest/hacking/checks.py b/tempest/hacking/checks.py
index 5943adfce..d8f25ab5c 100644
--- a/tempest/hacking/checks.py
+++ b/tempest/hacking/checks.py
@@ -257,6 +257,23 @@ def use_rand_uuid_instead_of_uuid4(logical_line, filename):
yield (0, msg)
+def dont_use_config_in_tempest_lib(logical_line, filename):
+ """Check that tempest.lib doesn't use tempest config
+
+ T114
+ """
+
+ if 'tempest/lib/' not in filename:
+ return
+
+ if ('tempest.config' in logical_line
+ or 'from tempest import config' in logical_line
+ or 'oslo_config' in logical_line):
+ msg = ('T114: tempest.lib can not have any dependency on tempest '
+ 'config.')
+ yield(0, msg)
+
+
def factory(register):
register(import_no_clients_in_api_and_scenario_tests)
register(scenario_tests_need_service_tags)
@@ -269,4 +286,5 @@ def factory(register):
register(get_resources_on_service_clients)
register(delete_resources_on_service_clients)
register(dont_import_local_tempest_into_lib)
+ register(dont_use_config_in_tempest_lib)
register(use_rand_uuid_instead_of_uuid4)