Commit 961cdebe authored by Jeff Booher-Kaeding's avatar Jeff Booher-Kaeding
Browse files

first pass of tree function.

parent 02c2c0f1
...@@ -29,7 +29,7 @@ def test_parser(string,current_group,current_test_set,current_set_guid,current_s ...@@ -29,7 +29,7 @@ def test_parser(string,current_group,current_test_set,current_set_guid,current_s
#"comment": string[-1], #FIXME:need to hash this out, sometime there is no comments #"comment": string[-1], #FIXME:need to hash this out, sometime there is no comments
"log": ' '.join(string) "log": ' '.join(string)
} }
return (test_list["guid"]+test_list["set guid"]), test_list return test_list
#Parse the ekl file, and create a map of the tests #Parse the ekl file, and create a map of the tests
def ekl_parser (file): def ekl_parser (file):
...@@ -105,11 +105,28 @@ def seq_parser(file): ...@@ -105,11 +105,28 @@ def seq_parser(file):
return temp_dict return temp_dict
def tree_list(input_list,file):
temp_list= input_list
while ( len(temp_list) > 0):
temp_dict = (temp_list.pop())
found = list()
pop_list = list()
for idx, test in enumerate(temp_list):
if test["group"] == temp_dict["group"]:
found.append(test)
pop_list.append(idx)
pop_list.sort(reverse=True)
for i in pop_list:
temp_list.pop(i)
file.write("### " + temp_dict["group"])
found.append(temp_dict)
dict_2_md(found,file)
#generic writer, takes a list of dicts and turns the dicts into an MD table. #generic writer, takes a list of dicts and turns the dicts into an MD table.
def dict_2_md(input_list,file): def dict_2_md(input_list,file):
if len(input_list) > 0: if len(input_list) > 0:
file.write("\n\n") file.write("\n\n")
#create header for MD table using dict keys #create header for MD table using dict keys
temp_string1, temp_string2 = "|", "|" temp_string1, temp_string2 = "|", "|"
for x in (input_list[0].keys()): for x in (input_list[0].keys()):
...@@ -159,7 +176,6 @@ def main(): ...@@ -159,7 +176,6 @@ def main():
# generate MD summary # generate MD summary
#TODO: this should be split out into functions, and also "Beautified"
with open('result.md', 'w') as resultfile: with open('result.md', 'w') as resultfile:
resultfile.write("# SCT Summary \n") resultfile.write("# SCT Summary \n")
resultfile.write("### 1. Dropped: "+str(len(would_not_run))+"\n") resultfile.write("### 1. Dropped: "+str(len(would_not_run))+"\n")
...@@ -171,11 +187,13 @@ def main(): ...@@ -171,11 +187,13 @@ def main():
resultfile.write("## 1. Silently dropped or missing") resultfile.write("## 1. Silently dropped or missing")
dict_2_md(would_not_run,resultfile) dict_2_md(would_not_run,resultfile)
resultfile.write("## 2. Failures") resultfile.write("## 4. Failure by group")
dict_2_md(failures,resultfile) resultfile.write("\n\n")
tree_list(failures,resultfile)
resultfile.write("## 3. Warnings") resultfile.write("## 3. Warnings by group")
dict_2_md(warnings,resultfile) resultfile.write("\n\n")
tree_list(warnings,resultfile)
#command line argument 3&4, key are to support a key & value search. #command line argument 3&4, key are to support a key & value search.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment