1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 from qm.test.result import Result
21
22
23
24
25
27 """A 'TestRun' stores the 'Result's from a single test run.
28
29 The primary contents of a 'TestRun' are the the 'Result's of the
30 run. In addition, each 'TestRun' has an associated set of
31 annotations, which are used to store global information about the
32 'TestRun'."""
33
35 """Return the 'Result' for the indicated test.
36
37 'id' -- The name of a test or resource.
38
39 'kind' -- The kind of result to retrieve. See 'Result' for a
40 list of the available result kinds.
41
42 returns -- The 'Result' corresponding to 'test_id'.
43
44 raises -- 'KeyError' if there is no result of the given 'kind'
45 for 'id' in the test run."""
46
47 raise NotImplementedError
48
49
51 """Return the annotation associated with 'key'.
52
53 'key' -- A string giving the name of an annotation.
54
55 returns -- A string giving the value of the annotation, or
56 'None' if there is no such annotation."""
57
58 raise NotImplementedError
59
60
62 """Return this run's dictionary of annotations.
63
64 returns -- A dictionary mapping annotation names (strings) to values
65 (also strings)."""
66
67 raise NotImplementedError
68
69
71 """Return 'Result's from the given directory..
72
73 'directory' -- A path to a directory in the test database.
74
75 'kind' -- The kind of results to return.
76
77 returns -- All the results within 'directory' (including its
78 subdirectories)."""
79
80 raise NotImplementedError
81
82
85 """Return 'Result's with a particular outcome.
86
87 'outcome' -- One of the 'Result.outcomes', or 'None'.
88
89 'directory' -- A path to a directory in the test database.
90
91 'kind' -- The kind of results to return.
92
93 returns -- All the results within 'directory' (including its
94 subdirectories) that have the indicated 'outcome', or, if
95 'outcome' is 'None', all test results from 'directory'."""
96
97 results = []
98 for result in self.GetAllResults(directory, kind):
99
100 if outcome and result.GetOutcome() != outcome:
101 continue
102 results.append(result)
103 return results
104
105
107 """Return statistics about the outcomes of tests.
108
109 'directory' -- A path to a directory in the test database.
110
111 'outcome' -- If not 'None', one of the 'Result.outcomes'.
112
113 returns -- A dictionary mapping outcomes to the number of test
114 results with that outcome located within 'directory' and its
115 subdirectories. If 'outcome' is not 'None', the dictionary
116 will have an entry only for the 'outcome' specified."""
117
118 if not outcome:
119 outcomes = Result.outcomes
120 else:
121 outcomes = (outcome,)
122 counts = {}
123 for o in outcomes:
124 counts[o] = len(self.GetResultsByOutcome(o, directory))
125 return counts
126