forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
print_skipped.py
executable file
·38 lines (33 loc) · 1.04 KB
/
print_skipped.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python3
import os
import xml.etree.ElementTree as et
def main(filename):
if not os.path.isfile(filename):
raise RuntimeError(f"Could not find junit file {repr(filename)}")
tree = et.parse(filename)
root = tree.getroot()
current_class = ""
for el in root.iter("testcase"):
cn = el.attrib["classname"]
for sk in el.findall("skipped"):
old_class = current_class
current_class = cn
if old_class != current_class:
yield None
yield {
"class_name": current_class,
"test_name": el.attrib["name"],
"message": sk.attrib["message"],
}
if __name__ == "__main__":
print("SKIPPED TESTS:")
i = 1
for test_data in main("test-data.xml"):
if test_data is None:
print("-" * 80)
else:
print(
f"#{i} {test_data['class_name']}."
f"{test_data['test_name']}: {test_data['message']}"
)
i += 1