aboutsummaryrefslogtreecommitdiffstats
path: root/.ci/utils/format_devtest_junitxml.py
blob: b941a64e60cc51f515d29edf1f333bdc99c92b11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from junitparser import JUnitXml, Element, Attr, TestCase
import argparse
import glob, os

class ClassNameTestCase(TestCase):
    classname = Attr('classname')

parser = argparse.ArgumentParser()
parser.add_argument("search_path")
parser.add_argument("output_name")
args = parser.parse_args()

xml = JUnitXml()
for file in glob.glob(args.search_path + "/**/*.xml", recursive=True):
    xml += JUnitXml.fromfile(file)

for suite in xml:
    for case in suite:
        classname_case = ClassNameTestCase.fromelem(case)
        if classname_case.name == 'test_all':
            classname_case.name = classname_case.classname
xml.write(args.output_name)