File: print_skipped.py

package info (click to toggle)
pandas 1.1.5%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 47,284 kB
  • sloc: python: 292,793; ansic: 8,591; sh: 608; makefile: 94
file content (38 lines) | stat: -rwxr-xr-x 1,064 bytes parent folder | download
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