Skip to content

Commit ff8017b

Browse files
committed
QPR-13744 QPR-13463: loop out of script and output fix
1 parent cfc22d3 commit ff8017b

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

Tools/xsl/reformat_junit.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import xml.etree.ElementTree as ET
22
import os
33
from typing import Dict, List
4+
import argparse
45

56

67
class TestCaseResult:
@@ -131,13 +132,20 @@ def writeJUnit(path_out, suites):
131132
def parseXML(input_file):
132133
suites = extract_suites(input_file)
133134
base = os.path.splitext(os.path.basename(input_file))[0]
134-
file_name = base.split("_")[1]
135+
parts = base.split("_")
136+
if len(parts) == 3:
137+
file_name = parts[1] + "_" + parts[2]
138+
else:
139+
file_name = parts[1]
135140
out_path = f"{file_name}_junit.xml"
136141
writeJUnit(out_path, suites)
137142
print(f" reformatted {input_file} to {out_path}")
138143

139144
if __name__ == "__main__":
140-
inputs = ["xunit_orea.xml", "xunit_ored.xml", "xunit_qle.xml", "xunit_ql.xml", "xunit_orep_analytics.xml", "xunit_orep_marketrisk.xml", "xunit_orep_proxy.xml", "xunit_orep_simm.xml"]
145+
argparser = argparse.ArgumentParser(description='Convert to Junit')
146+
argparser.add_argument('--file', help='The file to convert')
147+
main_args = argparser.parse_args()
148+
input_file = main_args.file
141149

142150
for p in inputs:
143151
if os.path.exists(p):

0 commit comments

Comments
 (0)