cf95998580dc796be0f0476bc7b5c77cf47834e3
[releng.git] / utils / test / scripts / conf_utils.py
1 import yaml
2
3
4 with open('./testcases.yaml') as f:
5     testcases_yaml = yaml.safe_load(f)
6 f.close()
7
8
9 def compose_format(fmt):
10     return 'format_' + fmt.strip()
11
12
13 def get_format(project, case):
14     testcases = testcases_yaml.get(project)
15     if isinstance(testcases, list):
16         for case_dict in testcases:
17             if case_dict['name'] == case:
18                 return compose_format(case_dict['format'])
19     return None
20
21
22 if __name__ == '__main__':
23     fmt = get_format('functest', 'vping_ssh')
24     print fmt