8 if 'CONFIG_FUNCTEST_YAML' not in os.environ:
9 raise Exception('CONFIG_FUNCTEST_YAML not configed')
10 self.config_functest = os.environ['CONFIG_FUNCTEST_YAML']
12 with open(self.config_functest) as f:
13 self.functest_yaml = yaml.safe_load(f)
14 self._parse(None, self.functest_yaml)
16 raise Exception('Parse {} failed'.format(self.config_functest))
19 def _parse(self, attr_now, left_parametes):
20 for param_n, param_v in left_parametes.iteritems():
21 attr_further = self._get_attr_further(attr_now, param_n)
22 if not isinstance(param_v, dict):
23 self.__setattr__(attr_further, param_v)
25 self._parse(attr_further, param_v)
27 def _get_attr_further(self, attr_now, next):
28 return attr_now if next == 'general' else (
29 '{}_{}'.format(attr_now, next) if attr_now else next)
31 def _set_others(self):
32 self.env_active = os.path.join(self.dir_functest_conf, "env_active")