|
1 | 1 | import dataclasses |
2 | 2 | import json |
3 | | -import os |
4 | 3 | from _colorize import get_colors # type: ignore[import-not-found] |
5 | 4 | from typing import Any |
6 | 5 |
|
@@ -179,34 +178,17 @@ def __str__(self) -> str: |
179 | 178 | def has_meaningful_duration(self): |
180 | 179 | return State.has_meaningful_duration(self.state) |
181 | 180 |
|
182 | | - def get_github_annotations(self) -> list[tuple[str, str]]: |
183 | | - """(test case name, message) of each failed test case. |
184 | | -
|
185 | | - Without test case details (crash, timeout, env changed, etc.), return |
186 | | - the test name and the test result. |
187 | | - """ |
188 | | - if not os.environ.get("GITHUB_STEP_SUMMARY"): |
189 | | - return [] |
190 | | - annotations = (self.errors or []) + (self.failures or []) |
191 | | - if not annotations: |
192 | | - message = "\n".join([str(self), *(self.env_changed_reasons or ())]) |
193 | | - annotations = [(self.test_name, message)] |
194 | | - return annotations |
195 | | - |
196 | | - def print_github_annotations(self) -> None: |
197 | | - """Print a GitHub Actions error annotation per failed test case.""" |
198 | | - for title, message in self.get_github_annotations(): |
199 | | - print(github_annotation(title, message), flush=True) |
200 | | - |
201 | 181 | def print_github_crash_annotation(self, fail_env_changed: bool) -> None: |
202 | 182 | """Annotate a failed test without test case failures. |
203 | 183 |
|
204 | | - Test case failures are annotated by the test runner, where they are |
205 | | - reported (see RegressionTestResult.printErrorList()). |
| 184 | + For example: crash, timeout, env changed. Test case failures are |
| 185 | + annotated by the test runner, where they are reported (see |
| 186 | + RegressionTestResult.printErrorList()). |
206 | 187 | """ |
207 | 188 | if (self.is_failed(fail_env_changed) |
208 | 189 | and not self.errors and not self.failures): |
209 | | - self.print_github_annotations() |
| 190 | + message = "\n".join([str(self), *(self.env_changed_reasons or ())]) |
| 191 | + print(github_annotation(self.test_name, message), flush=True) |
210 | 192 |
|
211 | 193 | def set_env_changed(self, *reasons): |
212 | 194 | if self.state is None or self.state == State.PASSED: |
|
0 commit comments