summaryrefslogtreecommitdiffstats
path: root/utils/test/scripts/testcases_parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils/test/scripts/testcases_parser.py')
-rw-r--r--utils/test/scripts/testcases_parser.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/utils/test/scripts/testcases_parser.py b/utils/test/scripts/testcases_parser.py
new file mode 100644
index 000000000..cf9599858
--- /dev/null
+++ b/utils/test/scripts/testcases_parser.py
@@ -0,0 +1,24 @@
+import yaml
+
+
+with open('./testcases.yaml') as f:
+ testcases_yaml = yaml.safe_load(f)
+f.close()
+
+
+def compose_format(fmt):
+ return 'format_' + fmt.strip()
+
+
+def get_format(project, case):
+ testcases = testcases_yaml.get(project)
+ if isinstance(testcases, list):
+ for case_dict in testcases:
+ if case_dict['name'] == case:
+ return compose_format(case_dict['format'])
+ return None
+
+
+if __name__ == '__main__':
+ fmt = get_format('functest', 'vping_ssh')
+ print fmt