diff options
author | 2016-12-21 15:42:54 +0800 | |
---|---|---|
committer | 2016-12-21 12:55:44 +0100 | |
commit | a59fea1046d167b4609c9b86836d178e799dc688 (patch) | |
tree | 64972a06ba7d10bbde13e63345136126dfa10a6e /functest/utils/config.py | |
parent | 3592444c8abcaca3312d831fd610d82bffd627ea (diff) |
Refactor test run related modules using new constants provider
JIRA: FUNCTEST-673
Change-Id: Ia37fb5a08c8fbc4a8acb666565ea887f9ae48b83
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'functest/utils/config.py')
-rw-r--r-- | functest/utils/config.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/functest/utils/config.py b/functest/utils/config.py index 4cee6349..84166c1d 100644 --- a/functest/utils/config.py +++ b/functest/utils/config.py @@ -11,20 +11,25 @@ class Config(object): try: with open(self.config_functest) as f: self.functest_yaml = yaml.safe_load(f) - self.parse(None, self.functest_yaml) + self._parse(None, self.functest_yaml) except: raise Exception('Parse {} failed'.format(self.config_functest)) + self._set_others() - def parse(self, attr_now, left_parametes): + def _parse(self, attr_now, left_parametes): for param_n, param_v in left_parametes.iteritems(): - attr_further = self.get_attr_further(attr_now, param_n) + attr_further = self._get_attr_further(attr_now, param_n) if not isinstance(param_v, dict): self.__setattr__(attr_further, param_v) else: - self.parse(attr_further, param_v) + self._parse(attr_further, param_v) - def get_attr_further(self, attr_now, next): + def _get_attr_further(self, attr_now, next): return attr_now if next == 'general' else ( '{}_{}'.format(attr_now, next) if attr_now else next) + def _set_others(self): + self.env_active = os.path.join(self.dir_functest_conf, "env_active") + + CONF = Config() |