File: common.py

package info (click to toggle)
junit2html 31.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 576 kB
  • sloc: xml: 3,208; python: 1,023; makefile: 6; sh: 5
file content (47 lines) | stat: -rw-r--r-- 1,080 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
39
40
41
42
43
44
45
46
47
"""
Common code between JUnit2HTML matrix and merge classes
"""
from __future__ import print_function

from typing import TYPE_CHECKING

from .parser import Case, Junit

if TYPE_CHECKING: # pragma: no cover
    from typing import Dict, List


class ReportContainer(object):
    """
    Hold one or more reports
    """
    reports: "Dict[str, Junit]"

    def __init__(self):
        self.reports = {}

    def add_report(self, filename: str) -> None:
        raise NotImplementedError()

    def failures(self):
        """
        Return all the failed test cases
        :return:
        """
        found: "List[Case]" = []
        for report in self.reports:
            for suite in self.reports[report].suites:
                found.extend(suite.failed())

        return found

    def skips(self):
        """
        Return all the skipped test cases
        :return:
        """
        found: "List[Case]" = []
        for report in self.reports:
            for suite in self.reports[report].suites:
                found.extend(suite.skipped())
        return found