TempestParser 3.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tempest_parser/__init__.py +0 -0
- tempest_parser/const.py +65 -0
- tempest_parser/etc/tempest-parser.conf +6 -0
- tempest_parser/manager/__init__.py +0 -0
- tempest_parser/manager/importers.py +600 -0
- tempest_parser/manager/models.py +100 -0
- tempest_parser/manager/test_manager.py +321 -0
- tempest_parser/parser/__init__.py +0 -0
- tempest_parser/parser/tempest_log_parser.py +346 -0
- tempest_parser/py.typed +0 -0
- tempest_parser/reports/__init__.py +0 -0
- tempest_parser/reports/csv_reporter.py +75 -0
- tempest_parser/reports/json_reporter.py +74 -0
- tempest_parser/reports/reporter.py +301 -0
- tempest_parser/res/all_sanity.list +136 -0
- tempest_parser/res/all_tests_tag_18.list +1523 -0
- tempest_parser/templates/grid_base.html +119 -0
- tempest_parser/templates/tempest_errors_grid.html +202 -0
- tempest_parser/templates/tempest_errors_report.html +315 -0
- tempest_parser/templates/tempest_trending_grid.html +267 -0
- tempest_parser/templates/tempest_trending_report.html +326 -0
- tempest_parser/tparser.py +327 -0
- tempest_parser/utils/__init__.py +0 -0
- tempest_parser/utils/config.py +35 -0
- tempestparser-3.0.0.dist-info/METADATA +320 -0
- tempestparser-3.0.0.dist-info/RECORD +30 -0
- tempestparser-3.0.0.dist-info/WHEEL +5 -0
- tempestparser-3.0.0.dist-info/entry_points.txt +2 -0
- tempestparser-3.0.0.dist-info/licenses/LICENSE +201 -0
- tempestparser-3.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""The parsed results: runs (executions), test cases and one case's result per run.
|
|
2
|
+
|
|
3
|
+
Times are seconds as floats (None when the input has none) and dates are timezone-aware
|
|
4
|
+
UTC datetimes; the reports format them.
|
|
5
|
+
"""
|
|
6
|
+
import os
|
|
7
|
+
from dataclasses import dataclass, field
|
|
8
|
+
from datetime import UTC, datetime
|
|
9
|
+
from typing import IO, Any
|
|
10
|
+
|
|
11
|
+
# how run dates are shown in reports and run names
|
|
12
|
+
DATE_FORMAT = "%d/%m/%Y %H:%M GMT"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(slots=True)
|
|
16
|
+
class Result:
|
|
17
|
+
"""One test's result in one run."""
|
|
18
|
+
result: str = ""
|
|
19
|
+
time: float | None = None
|
|
20
|
+
message: str = ""
|
|
21
|
+
trace: str = ""
|
|
22
|
+
slowest: bool = False
|
|
23
|
+
setup_fail: bool = False
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass(slots=True)
|
|
27
|
+
class Case:
|
|
28
|
+
"""One test; the class name is the key it is stored under in TestsManager.tests."""
|
|
29
|
+
test_name: str = ""
|
|
30
|
+
uuid: str = ""
|
|
31
|
+
test_options: str = ""
|
|
32
|
+
tags: list[str] = field(default_factory=list)
|
|
33
|
+
# run (execution) name -> result
|
|
34
|
+
results: dict[str, Result] = field(default_factory=dict)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass(slots=True)
|
|
38
|
+
class Execution:
|
|
39
|
+
"""One run, named after its source file (or folder with --force-single)."""
|
|
40
|
+
name: str
|
|
41
|
+
date: datetime
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def date_label(self) -> str:
|
|
45
|
+
return self.date.strftime(DATE_FORMAT)
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def filename(self) -> str:
|
|
49
|
+
return os.path.basename(self.name)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@dataclass(slots=True)
|
|
53
|
+
class Summary:
|
|
54
|
+
"""Counts and total time of one run's results."""
|
|
55
|
+
total: int = 0
|
|
56
|
+
ok: int = 0
|
|
57
|
+
fail: int = 0
|
|
58
|
+
error: int = 0
|
|
59
|
+
skip: int = 0
|
|
60
|
+
time: float = 0.0
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def parse_seconds(value: str | float | None) -> float | None:
|
|
64
|
+
"""Seconds as a float from 1.5, "1.5", "1.5s" or "1.50 s"; None when empty or not a number."""
|
|
65
|
+
if value is None or isinstance(value, float):
|
|
66
|
+
return value
|
|
67
|
+
if isinstance(value, int):
|
|
68
|
+
return float(value)
|
|
69
|
+
value = value.strip().removesuffix("s").strip()
|
|
70
|
+
try:
|
|
71
|
+
return float(value)
|
|
72
|
+
except ValueError:
|
|
73
|
+
return None
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def format_seconds(seconds: float | None) -> str:
|
|
77
|
+
"""A time for reports: "1.50s" under a minute, "2m 05s" under an hour, else "1h 02m";
|
|
78
|
+
"" for None."""
|
|
79
|
+
if seconds is None:
|
|
80
|
+
return ""
|
|
81
|
+
if seconds < 60:
|
|
82
|
+
return f"{seconds:.2f}s"
|
|
83
|
+
minutes, secs = divmod(round(seconds), 60)
|
|
84
|
+
if minutes < 60:
|
|
85
|
+
return f"{minutes}m {secs:02d}s"
|
|
86
|
+
hours, minutes = divmod(minutes, 60)
|
|
87
|
+
return f"{hours}h {minutes:02d}m"
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def file_date(source: str | IO[Any]) -> datetime:
|
|
91
|
+
"""Modification time of a path or an open file, as a UTC datetime; now for streams
|
|
92
|
+
without a file behind them (e.g. stdin)."""
|
|
93
|
+
try:
|
|
94
|
+
if hasattr(source, "fileno"):
|
|
95
|
+
mtime = os.fstat(source.fileno()).st_mtime
|
|
96
|
+
else:
|
|
97
|
+
mtime = os.stat(source).st_mtime
|
|
98
|
+
except (OSError, ValueError):
|
|
99
|
+
return datetime.now(UTC)
|
|
100
|
+
return datetime.fromtimestamp(mtime, UTC)
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
import re
|
|
4
|
+
from collections.abc import Iterable, KeysView
|
|
5
|
+
from dataclasses import dataclass, field
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
|
|
8
|
+
from tempest_parser.const import REQUIRED_RUN, Status
|
|
9
|
+
from tempest_parser.manager.models import Case, Execution, Result, Summary, file_date
|
|
10
|
+
|
|
11
|
+
log = logging.getLogger(__name__)
|
|
12
|
+
|
|
13
|
+
pkg_dir = os.path.dirname(__file__)
|
|
14
|
+
pkg_dir = os.path.join(pkg_dir, os.pardir)
|
|
15
|
+
pkg_dir = os.path.normpath(pkg_dir)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclass(slots=True)
|
|
19
|
+
class _ClassIndex:
|
|
20
|
+
"""Lookup tables for one class's tests (see TestsManager._class_index)."""
|
|
21
|
+
tests: list[Case]
|
|
22
|
+
length: int = 0
|
|
23
|
+
# (test name, options) -> positions in `tests`
|
|
24
|
+
by_key: dict[tuple[str, str], list[int]] = field(default_factory=dict)
|
|
25
|
+
# test name -> first position
|
|
26
|
+
by_name: dict[str, int] = field(default_factory=dict)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# (class, test name, uuid, options, tags)
|
|
30
|
+
SplitName = tuple[str, str, str, str, list[str]]
|
|
31
|
+
|
|
32
|
+
# a test id: "setUpClass (class)", or an optional unittest2 prefix of three parts, then
|
|
33
|
+
# class.test_name[tags](options) where the class is in a tempest, cvp_checks or tempest plugin
|
|
34
|
+
# package; the test name is the last dotted part before the first "[".
|
|
35
|
+
_TEST_ID_RE = re.compile(
|
|
36
|
+
r"^(?:(?:setUpClass|tearDownClass)\s*\((?P<setup>[^)]*)\)"
|
|
37
|
+
r"|(?:unittest2(?:\.[^.]+){2}\.)?"
|
|
38
|
+
r"(?P<cls>(?:(?:tempest|cvp_checks)[^.\[]*|[^.\[]*_tempest_(?:plugin|tests))(?:\.[^.\[]+)*)"
|
|
39
|
+
r"\.(?P<test>(?P<name>[^.\[]+)(?:\[(?P<tags>[^\]]*)\](?P<options>.*))?))$")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class TestsManager:
|
|
43
|
+
"""All runs and their results, matched by class, test name, options and UUID.
|
|
44
|
+
|
|
45
|
+
`tests`: class name -> [Case]; `executions`: run name -> Execution.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
def __init__(self) -> None:
|
|
49
|
+
self.tests: dict[str, list[Case]] = {}
|
|
50
|
+
self.executions: dict[str, Execution] = {}
|
|
51
|
+
self.required_execution_name = REQUIRED_RUN
|
|
52
|
+
# class name -> lookup tables; see _class_index
|
|
53
|
+
self._index: dict[str, _ClassIndex] = {}
|
|
54
|
+
|
|
55
|
+
def add_required(self, all_tests_filepath: str, use_raw_names: bool = False) -> None:
|
|
56
|
+
"""Preload the baseline test list (relative paths are under the package) as the
|
|
57
|
+
`required` run. Replaces the tests loaded so far."""
|
|
58
|
+
path = os.path.join(pkg_dir, "res", all_tests_filepath)
|
|
59
|
+
self.tests = self._all_tests_file_preload(path, use_raw_names=use_raw_names)
|
|
60
|
+
self.add_execution(REQUIRED_RUN, file_date(path))
|
|
61
|
+
|
|
62
|
+
# In case we'll need to list all of the tests in tempest
|
|
63
|
+
# and mark which ones was executed, we have list of all tests
|
|
64
|
+
# It produced by ./tempest run --list-tests >all_tests_tag_<N>.list
|
|
65
|
+
def _all_tests_file_preload(self, resource_file: str,
|
|
66
|
+
use_raw_names: bool = False) -> dict[str, list[Case]]:
|
|
67
|
+
_tests: dict[str, list[Case]] = {}
|
|
68
|
+
|
|
69
|
+
# load all tests file
|
|
70
|
+
with open(resource_file, encoding="utf-8") as tests_file:
|
|
71
|
+
for line in tests_file:
|
|
72
|
+
_class_name, _test_name, _uuid, _test_options, _tags = \
|
|
73
|
+
self.split_test_name(
|
|
74
|
+
line.replace("\n", ""),
|
|
75
|
+
raw_names=use_raw_names
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
_test_item = Case(_test_name, _uuid, _test_options, _tags)
|
|
79
|
+
_test_item.results[REQUIRED_RUN] = Result(Status.REQUIRED, 0.0)
|
|
80
|
+
_tests.setdefault(_class_name, []).append(_test_item)
|
|
81
|
+
return _tests
|
|
82
|
+
|
|
83
|
+
@staticmethod
|
|
84
|
+
def split_test_name(full_test_name: str, raw_names: bool = False) -> SplitName:
|
|
85
|
+
"""(class, test name, uuid, options, tags) of a test id:
|
|
86
|
+
"package.module.Class.test_name[id-x,tag](options)", "setUpClass (class)" or a unittest2
|
|
87
|
+
failure id ("unittest2.a.b." then a test id). Only tempest, cvp_checks and tempest
|
|
88
|
+
plugin packages are known; anything else gives empty parts. With `raw_names` the test
|
|
89
|
+
name keeps its brackets and options, and no uuid, options or tags are split off."""
|
|
90
|
+
match = _TEST_ID_RE.match(full_test_name)
|
|
91
|
+
if match is None:
|
|
92
|
+
return "", "", "", "", []
|
|
93
|
+
if match.group("setup") is not None:
|
|
94
|
+
return match.group("setup"), "", "", "", []
|
|
95
|
+
if raw_names:
|
|
96
|
+
return match.group("cls"), match.group("test"), "", "", []
|
|
97
|
+
uuid = ""
|
|
98
|
+
tags = []
|
|
99
|
+
for tag in (match.group("tags") or "").split(","):
|
|
100
|
+
if tag.startswith("id-"):
|
|
101
|
+
uuid = tag
|
|
102
|
+
elif tag:
|
|
103
|
+
tags.append(tag)
|
|
104
|
+
return match.group("cls"), match.group("name"), uuid, match.group("options") or "", tags
|
|
105
|
+
|
|
106
|
+
def _class_index(self, class_name: str) -> _ClassIndex | None:
|
|
107
|
+
"""Lookup indexes for one class's tests, or None if the class is unknown.
|
|
108
|
+
|
|
109
|
+
Kept up to date by _append_test; rebuilt when the class's list was replaced or
|
|
110
|
+
changed elsewhere (add_required, code that edits `tests` directly).
|
|
111
|
+
"""
|
|
112
|
+
tests = self.tests.get(class_name)
|
|
113
|
+
if tests is None:
|
|
114
|
+
return None
|
|
115
|
+
cached = self._index.get(class_name)
|
|
116
|
+
if cached is None or cached.tests is not tests or cached.length != len(tests):
|
|
117
|
+
cached = _ClassIndex(tests, len(tests))
|
|
118
|
+
for position, test in enumerate(tests):
|
|
119
|
+
cached.by_key.setdefault((test.test_name, test.test_options), []).append(position)
|
|
120
|
+
cached.by_name.setdefault(test.test_name, position)
|
|
121
|
+
self._index[class_name] = cached
|
|
122
|
+
return cached
|
|
123
|
+
|
|
124
|
+
def _append_test(self, class_name: str, test_item: Case) -> None:
|
|
125
|
+
tests = self.tests.setdefault(class_name, [])
|
|
126
|
+
cached = self._class_index(class_name)
|
|
127
|
+
assert cached is not None
|
|
128
|
+
position = len(tests)
|
|
129
|
+
tests.append(test_item)
|
|
130
|
+
cached.length += 1
|
|
131
|
+
cached.by_key.setdefault((test_item.test_name, test_item.test_options),
|
|
132
|
+
[]).append(position)
|
|
133
|
+
cached.by_name.setdefault(test_item.test_name, position)
|
|
134
|
+
|
|
135
|
+
def test_name_lookup(self, class_name: str, test_name: str, uuid: str | None,
|
|
136
|
+
test_options: str | None) -> int:
|
|
137
|
+
"""Position of the first test with this name and options whose UUID matches
|
|
138
|
+
(either UUID empty counts as a match), or -1."""
|
|
139
|
+
cached = self._class_index(class_name)
|
|
140
|
+
# options None match no test: every test has them as a string
|
|
141
|
+
if cached is None or test_options is None:
|
|
142
|
+
return -1
|
|
143
|
+
tests = cached.tests
|
|
144
|
+
for position in cached.by_key.get((test_name, test_options), ()):
|
|
145
|
+
_uuid = tests[position].uuid
|
|
146
|
+
if uuid == '' or _uuid == '' or _uuid == uuid:
|
|
147
|
+
return position
|
|
148
|
+
return -1
|
|
149
|
+
|
|
150
|
+
def test_name_lookup_bare(self, class_name: str, test_name: str) -> int:
|
|
151
|
+
cached = self._class_index(class_name)
|
|
152
|
+
if cached is None:
|
|
153
|
+
return -1
|
|
154
|
+
return cached.by_name.get(test_name, -1)
|
|
155
|
+
|
|
156
|
+
def partial_class_name_lookup(self, class_name_short: str, test_name: str,
|
|
157
|
+
uuid: str | None = None,
|
|
158
|
+
test_options: str | None = None) -> str | None:
|
|
159
|
+
_list = []
|
|
160
|
+
for _class_name in self.tests:
|
|
161
|
+
if _class_name.endswith(class_name_short):
|
|
162
|
+
_index = self.test_name_lookup(_class_name, test_name,
|
|
163
|
+
uuid, test_options)
|
|
164
|
+
if _index > -1:
|
|
165
|
+
_full_class_name = _class_name
|
|
166
|
+
_list.append(_full_class_name)
|
|
167
|
+
return _list[0] if _list else None
|
|
168
|
+
|
|
169
|
+
def add_execution(self, name: str, date: datetime) -> None:
|
|
170
|
+
"""Record a run; `date` is a UTC datetime. A run of the same name is replaced."""
|
|
171
|
+
self.executions[name] = Execution(name, date)
|
|
172
|
+
|
|
173
|
+
def get_sorted_executions(self) -> list[Execution]:
|
|
174
|
+
"""Runs ordered by date; runs with the same date keep the order they were added in."""
|
|
175
|
+
return sorted(self.executions.values(), key=lambda execution: execution.date)
|
|
176
|
+
|
|
177
|
+
def mark_slowest_test_in_execution_by_name(self, execution_name: str, class_name: str,
|
|
178
|
+
test_name: str, uuid: str | None = None,
|
|
179
|
+
test_options: str | None = None) -> None:
|
|
180
|
+
_index = self.test_name_lookup(class_name, test_name, uuid,
|
|
181
|
+
test_options)
|
|
182
|
+
if _index > -1:
|
|
183
|
+
# mark slowest tests
|
|
184
|
+
self.tests[class_name][_index].results[execution_name].slowest = True
|
|
185
|
+
else:
|
|
186
|
+
log.warning("Parsed slowest test not found in list: %s, %s, %s",
|
|
187
|
+
execution_name, class_name, test_name)
|
|
188
|
+
|
|
189
|
+
def add_fail_data_for_test(self, execution_name: str, class_name: str, test_name: str,
|
|
190
|
+
test_options: str, trace: str, message: str,
|
|
191
|
+
class_name_short: bool = False,
|
|
192
|
+
uuid: str | None = None) -> None:
|
|
193
|
+
if class_name == "setUpClass" or class_name == "tearDownClass":
|
|
194
|
+
# if this is a setUpClass situation,
|
|
195
|
+
# mark all tests with this result
|
|
196
|
+
# only the first test of the class gets the data
|
|
197
|
+
if self.tests.get(test_name):
|
|
198
|
+
_result = self.tests[test_name][0].results[execution_name]
|
|
199
|
+
_result.trace = trace
|
|
200
|
+
_result.message = message
|
|
201
|
+
else:
|
|
202
|
+
# lookup test in the list
|
|
203
|
+
if class_name_short:
|
|
204
|
+
_full_class_name = self.partial_class_name_lookup(class_name,
|
|
205
|
+
test_name)
|
|
206
|
+
if _full_class_name is None:
|
|
207
|
+
_full_class_name = class_name
|
|
208
|
+
else:
|
|
209
|
+
_full_class_name = class_name
|
|
210
|
+
_index = self.test_name_lookup(
|
|
211
|
+
_full_class_name,
|
|
212
|
+
test_name,
|
|
213
|
+
uuid,
|
|
214
|
+
test_options
|
|
215
|
+
)
|
|
216
|
+
if _index > -1:
|
|
217
|
+
# this matches one already in the list, copy
|
|
218
|
+
_result = self.tests[_full_class_name][_index].results[execution_name]
|
|
219
|
+
_result.trace = trace
|
|
220
|
+
_result.message = message
|
|
221
|
+
else:
|
|
222
|
+
log.warning("Test not found: %s, %s; for message: %s",
|
|
223
|
+
_full_class_name, test_name, message)
|
|
224
|
+
|
|
225
|
+
def add_result_for_test(self, execution_name: str, class_name: str, test_name: str,
|
|
226
|
+
uuid: str, test_options: str, result: str,
|
|
227
|
+
running_time: float | None, message: str = '', trace: str = '',
|
|
228
|
+
tags: Iterable[str] | None = None, class_name_short: bool = False,
|
|
229
|
+
test_name_bare: bool = False) -> None:
|
|
230
|
+
"""Add or replace a test's result in a run; `running_time` is seconds or None.
|
|
231
|
+
A second result for the same test and run keeps both messages."""
|
|
232
|
+
_result = Result(result, running_time, message, trace)
|
|
233
|
+
if class_name == "setUpClass" or class_name == "tearDownClass":
|
|
234
|
+
# a class setup/teardown failure: only the first test of the class gets it
|
|
235
|
+
if self.tests.get(test_name):
|
|
236
|
+
_result.setup_fail = True
|
|
237
|
+
self.tests[test_name][0].results[execution_name] = _result
|
|
238
|
+
else:
|
|
239
|
+
# if this is a normal class and test name -> look it up
|
|
240
|
+
# lookup test in the list
|
|
241
|
+
if class_name_short:
|
|
242
|
+
_full_class_name = self.partial_class_name_lookup(class_name,
|
|
243
|
+
test_name)
|
|
244
|
+
if _full_class_name is None:
|
|
245
|
+
_full_class_name = class_name
|
|
246
|
+
else:
|
|
247
|
+
_full_class_name = class_name
|
|
248
|
+
if test_name_bare:
|
|
249
|
+
_index = self.test_name_lookup_bare(
|
|
250
|
+
_full_class_name,
|
|
251
|
+
test_name
|
|
252
|
+
)
|
|
253
|
+
else:
|
|
254
|
+
_index = self.test_name_lookup(
|
|
255
|
+
_full_class_name,
|
|
256
|
+
test_name,
|
|
257
|
+
uuid,
|
|
258
|
+
test_options
|
|
259
|
+
)
|
|
260
|
+
if _index > -1:
|
|
261
|
+
# this matches one already in the list, copy
|
|
262
|
+
_rs = self.tests[_full_class_name][_index].results
|
|
263
|
+
# the test already has a result in this run: keep both messages, old first
|
|
264
|
+
if execution_name in _rs:
|
|
265
|
+
_old = _rs[execution_name]
|
|
266
|
+
_result.message = (f"{_old.result}: {_old.message}\n"
|
|
267
|
+
f"\n{_result.result}: {_result.message}\n")
|
|
268
|
+
_rs[execution_name] = _result
|
|
269
|
+
else:
|
|
270
|
+
# the test is not there, add it
|
|
271
|
+
_test_item = Case(test_name, uuid, test_options,
|
|
272
|
+
list(tags) if tags else [])
|
|
273
|
+
_test_item.results[execution_name] = _result
|
|
274
|
+
self._append_test(_full_class_name, _test_item)
|
|
275
|
+
|
|
276
|
+
def get_tests_for_class(self, class_name: str) -> list[Case]:
|
|
277
|
+
return self.tests.get(class_name, [])
|
|
278
|
+
|
|
279
|
+
def get_executions(self) -> KeysView[str]:
|
|
280
|
+
return self.executions.keys()
|
|
281
|
+
|
|
282
|
+
def get_test_classes(self) -> KeysView[str]:
|
|
283
|
+
return self.tests.keys()
|
|
284
|
+
|
|
285
|
+
def class_has_errors(self, class_name: str) -> bool:
|
|
286
|
+
"""True if any test of the class failed in any run."""
|
|
287
|
+
return any(result.result == Status.FAIL
|
|
288
|
+
for test in self.tests.get(class_name, ())
|
|
289
|
+
for result in test.results.values())
|
|
290
|
+
|
|
291
|
+
def summarize(self, executions: Iterable[str] | None = None) -> dict[str, Summary]:
|
|
292
|
+
"""{run name: Summary} for the given runs (all by default), in one pass over the tests."""
|
|
293
|
+
names = list(self.executions) if executions is None else list(executions)
|
|
294
|
+
summaries = {name: Summary() for name in names}
|
|
295
|
+
for tests in self.tests.values():
|
|
296
|
+
for test in tests:
|
|
297
|
+
for name, result in test.results.items():
|
|
298
|
+
summary = summaries.get(name)
|
|
299
|
+
if summary is None:
|
|
300
|
+
continue
|
|
301
|
+
summary.total += 1
|
|
302
|
+
if result.time:
|
|
303
|
+
summary.time += result.time
|
|
304
|
+
if result.result == Status.OK:
|
|
305
|
+
summary.ok += 1
|
|
306
|
+
elif result.result == Status.FAIL:
|
|
307
|
+
summary.fail += 1
|
|
308
|
+
elif result.result == Status.ERROR:
|
|
309
|
+
summary.error += 1
|
|
310
|
+
elif result.result == Status.SKIP:
|
|
311
|
+
summary.skip += 1
|
|
312
|
+
return summaries
|
|
313
|
+
|
|
314
|
+
def get_summary_for_execution(self, execution_name: str) -> Summary:
|
|
315
|
+
return self.summarize([execution_name])[execution_name]
|
|
316
|
+
|
|
317
|
+
def log_summaries(self, executions: Iterable[str]) -> None:
|
|
318
|
+
"""Log a one-line summary of each of the given runs."""
|
|
319
|
+
for name, summary in self.summarize(executions).items():
|
|
320
|
+
log.info("Tempest testrun %s: %s executed: %s passed, %s failed, %s skipped",
|
|
321
|
+
name, summary.total, summary.ok, summary.fail, summary.skip)
|
|
File without changes
|