MCPcopy Create free account
hub / github.com/pytest-dev/pytest / summary_stats

Method summary_stats

src/_pytest/terminal.py:1030–1065  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1028 self._tw.line(content)
1029
1030 def summary_stats(self) -> None:
1031 if self.verbosity < -1:
1032 return
1033
1034 session_duration = timing.time() - self._sessionstarttime
1035 (parts, main_color) = self.build_summary_stats_line()
1036 line_parts = []
1037
1038 display_sep = self.verbosity >= 0
1039 if display_sep:
1040 fullwidth = self._tw.fullwidth
1041 for text, markup in parts:
1042 with_markup = self._tw.markup(text, **markup)
1043 if display_sep:
1044 fullwidth += len(with_markup) - len(text)
1045 line_parts.append(with_markup)
1046 msg = ", ".join(line_parts)
1047
1048 main_markup = {main_color: True}
1049 duration = f" in {format_session_duration(session_duration)}"
1050 duration_with_markup = self._tw.markup(duration, **main_markup)
1051 if display_sep:
1052 fullwidth += len(duration_with_markup) - len(duration)
1053 msg += duration_with_markup
1054
1055 if display_sep:
1056 markup_for_end_sep = self._tw.markup("", **main_markup)
1057 if markup_for_end_sep.endswith("\x1b[0m"):
1058 markup_for_end_sep = markup_for_end_sep[:-4]
1059 fullwidth += len(markup_for_end_sep)
1060 msg += markup_for_end_sep
1061
1062 if display_sep:
1063 self.write_sep("=", msg, fullwidth=fullwidth, **main_markup)
1064 else:
1065 self.write_line(msg, **main_markup)
1066
1067 def short_test_summary(self) -> None:
1068 if not self.reportchars:

Callers 1

pytest_sessionfinishMethod · 0.95

Calls 7

write_sepMethod · 0.95
write_lineMethod · 0.95
format_session_durationFunction · 0.85
timeMethod · 0.80
appendMethod · 0.80
markupMethod · 0.45

Tested by

no test coverage detected