[Asterisk-code-review] test config: Handle parsing of the global settings a bit better (testsuite[master])

Anonymous Coward asteriskteam at digium.com
Sun Oct 25 09:36:34 CDT 2015


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: test_config: Handle parsing of the global settings a bit better
......................................................................


test_config: Handle parsing of the global settings a bit better

This patch merely does a bit of minor restructuring and cleanup of the code
responsible for determining the global settings block in the top most
test-config.yaml file.

Change-Id: I5438d115e38149f8e0dc38f2c74aa74b01d9d3c7
---
M lib/python/asterisk/test_config.py
1 file changed, 11 insertions(+), 12 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/lib/python/asterisk/test_config.py b/lib/python/asterisk/test_config.py
index 3338833..b773726 100644
--- a/lib/python/asterisk/test_config.py
+++ b/lib/python/asterisk/test_config.py
@@ -265,7 +265,7 @@
         self.excluded_tests = []
         self.features = set()
         self.feature_check = {}
-        self.test_configuration = "(none)"
+        self.test_configuration = None
         self.condition_definitions = []
         self.global_test_config = global_test_config
 
@@ -291,18 +291,17 @@
 
         if "global-settings" in self.config:
             settings = self.config['global-settings']
-            if "condition-definitions" in settings:
-                self.condition_definitions = settings['condition-definitions']
-            if "test-configuration" in settings:
-                self.test_configuration = settings['test-configuration']
-                if self.test_configuration in self.config:
-                    self.config = self.config[self.test_configuration]
+            self.condition_definitions = settings.get('condition-definitions', [])
+            self.test_configuration = settings.get('test-configuration')
 
-                    if self.config is not None and 'exclude-tests' in self.config:
-                        self.excluded_tests = self.config['exclude-tests']
-                else:
-                    print ("WARNING - test configuration [%s] not found in "
-                           "config file" % self.test_configuration)
+            if self.test_configuration and self.test_configuration in self.config:
+                self.config = self.config[self.test_configuration]
+
+                if self.config is not None and 'exclude-tests' in self.config:
+                    self.excluded_tests = self.config['exclude-tests']
+            else:
+                print ("WARNING - test configuration [%s] not found in "
+                       "config file" % self.test_configuration)
 
     def _process_testinfo(self):
         """Process the test information block"""

-- 
To view, visit https://gerrit.asterisk.org/1519
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5438d115e38149f8e0dc38f2c74aa74b01d9d3c7
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list