MCPcopy Index your code
hub / github.com/RustPython/RustPython / display_result

Method display_result

Lib/test/libregrtest/results.py:205–269  ·  view source on GitHub ↗
(self, tests: TestTuple, quiet: bool, print_slowest: bool)

Source from the content-addressed store, hash-verified

203 f.write(s)
204
205 def display_result(self, tests: TestTuple, quiet: bool, print_slowest: bool) -> None:
206 ansi = get_colors()
207 green = ansi.GREEN
208 red = ansi.BOLD_RED
209 reset = ansi.RESET
210 yellow = ansi.YELLOW
211
212 if print_slowest:
213 self.test_times.sort(reverse=True)
214 print()
215 print(f"{yellow}10 slowest tests:{reset}")
216 for test_time, test in self.test_times[:10]:
217 print(f"- {test}: {format_duration(test_time)}")
218
219 all_tests = []
220 omitted = set(tests) - self.get_executed()
221
222 # less important
223 all_tests.append(
224 (sorted(omitted), "test", f"{yellow}{{}} omitted:{reset}")
225 )
226 if not quiet:
227 all_tests.append(
228 (self.skipped, "test", f"{yellow}{{}} skipped:{reset}")
229 )
230 all_tests.append(
231 (
232 self.resource_denied,
233 "test",
234 f"{yellow}{{}} skipped (resource denied):{reset}",
235 )
236 )
237 all_tests.append(
238 (self.run_no_tests, "test", f"{yellow}{{}} run no tests:{reset}")
239 )
240
241 # more important
242 all_tests.append(
243 (
244 self.env_changed,
245 "test",
246 f"{yellow}{{}} altered the execution environment (env changed):{reset}",
247 )
248 )
249 all_tests.append((self.rerun, "re-run test", f"{yellow}{{}}:{reset}"))
250 all_tests.append((self.bad, "test", f"{red}{{}} failed:{reset}"))
251
252 for tests_list, count_text, title_format in all_tests:
253 if tests_list:
254 print()
255 count_text = count(len(tests_list), count_text)
256 print(title_format.format(count_text))
257 printlist(tests_list)
258
259 if self.good and not quiet:
260 print()
261 text = count(len(self.good), "test")
262 text = f"{green}{text} OK.{reset}"

Callers

nothing calls this directly

Calls 13

get_executedMethod · 0.95
is_all_goodMethod · 0.95
get_colorsFunction · 0.90
format_durationFunction · 0.85
setFunction · 0.85
sortedFunction · 0.85
countFunction · 0.85
lenFunction · 0.85
printlistFunction · 0.85
printFunction · 0.50
sortMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected