From 59a8fe485e107df7fac3bfc85ff38b2bf006ab6c Mon Sep 17 00:00:00 2001 From: Michael Hanselmann Date: Fri, 20 Apr 2012 20:53:42 +0200 Subject: [PATCH] QA: Add default setting for tests Commit 1010ec70b1 enabled all tests by default. In some scenarios where the configuration is static one may not want newly added tests to be run. Signed-off-by: Michael Hanselmann Reviewed-by: Iustin Pop --- qa/qa-sample.json | 3 +++ qa/qa_config.py | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/qa/qa-sample.json b/qa/qa-sample.json index 7ec51a8..0cfdf2e 100644 --- a/qa/qa-sample.json +++ b/qa/qa-sample.json @@ -56,6 +56,9 @@ }, "tests": { + "# Whether tests are enabled or disabled by default": null, + "default": true, + "env": true, "os": true, "tags": true, diff --git a/qa/qa_config.py b/qa/qa_config.py index b4cff14..e058a71 100644 --- a/qa/qa_config.py +++ b/qa/qa_config.py @@ -68,7 +68,14 @@ def TestEnabled(tests): """ if isinstance(tests, basestring): tests = [tests] - return compat.all(cfg.get("tests", {}).get(t, True) for t in tests) + + # Get settings for all tests + all_tests = cfg.get("tests", {}) + + # Get default setting + default = all_tests.get("default", True) + + return compat.all(all_tests.get(name, default) for name in tests) def GetMasterNode(): -- 1.7.10.4