|
23 | 23 | 'testcases': ('lifetime', 'id', 'description', 'tags'), |
24 | 24 | 'include': ('ref', 'parameters'), |
25 | 25 | } |
26 | | -# The canonical result values are -1, 0, and 1, for FAIL, MISS (or DNF), and PASS, respectively; |
27 | | -# these concrete numbers are important because we do rely on their ordering. Note that MISS/DNF should |
28 | | -# not be reported because it is tantamount to a result being absent. (Therefore the NIL_RESULT default |
29 | | -# value below.) |
30 | | -TESTCASE_VERDICTS = {'PASS': 1, 'FAIL': -1} |
31 | | -NIL_RESULT = {'result': 0} |
| 26 | +# The canonical result values are -1, 0, and 1, for FAIL, ABORT, and PASS, respectively; |
| 27 | +# -- in addition, None is used to encode a missing value, but must not be included in a formal report! -- |
| 28 | +# these concrete numbers are important because we do rely on their ordering. |
| 29 | +TESTCASE_VERDICTS = {'PASS': 1, 'ABORT': 0, 'FAIL': -1} |
32 | 30 |
|
33 | 31 |
|
34 | 32 | def _check_keywords(ctx, d, keywords=KEYWORDS): |
@@ -208,18 +206,26 @@ def select(self, name, selectors): |
208 | 206 | suite.include_testcases([tc for tc in self.testcases if test_selectors(selectors, tc['tags'])]) |
209 | 207 | return suite |
210 | 208 |
|
211 | | - def eval_buckets(self, results) -> tuple[list[dict], list[dict], list[dict]]: |
212 | | - """returns lists of (failed, missing, passed) test cases""" |
| 209 | + def eval_buckets(self, results) -> dict: |
| 210 | + """ |
| 211 | + returns buckets of test cases by means of a mapping |
| 212 | +
|
| 213 | + None: list of missing testcases |
| 214 | + -1: list of failed testcases |
| 215 | + 0: list of aborted testcases |
| 216 | + 1: list of passed testcases |
| 217 | + """ |
213 | 218 | by_value = defaultdict(list) |
214 | 219 | for testcase in self.testcases: |
215 | | - value = results.get(testcase['id'], NIL_RESULT).get('result', 0) |
| 220 | + value = results.get(testcase['id'], {}).get('result') |
216 | 221 | by_value[value].append(testcase) |
217 | | - return by_value[-1], by_value[0], by_value[1] |
| 222 | + return by_value |
218 | 223 |
|
219 | 224 | def evaluate(self, results) -> int: |
220 | 225 | """returns overall result""" |
221 | 226 | return min([ |
222 | | - results.get(testcase['id'], NIL_RESULT).get('result', 0) |
| 227 | + # here, we treat None (MISSING) as 0 (ABORT) |
| 228 | + results.get(testcase['id'], {}).get('result') or 0 |
223 | 229 | for testcase in self.testcases |
224 | 230 | ], default=0) |
225 | 231 |
|
|
0 commit comments