MCPcopy
hub / github.com/pytest-dev/pytest / build_summary_stats_line

Method build_summary_stats_line

src/_pytest/terminal.py:1425–1448  ·  view source on GitHub ↗

Build the parts used in the last summary stats line. The summary stats line is the line shown at the end, "=== 12 passed, 2 errors in Xs===". This function builds a list of the "parts" that make up for the text in that line, in the example above it would be::

(self)

Source from the content-addressed store, hash-verified

1423 self._main_color = self._determine_main_color(bool(unknown_types))
1424
1425 def build_summary_stats_line(self) -> tuple[list[tuple[str, dict[str, bool]]], str]:
1426 """
1427 Build the parts used in the last summary stats line.
1428
1429 The summary stats line is the line shown at the end, "=== 12 passed, 2 errors in Xs===".
1430
1431 This function builds a list of the "parts" that make up for the text in that line, in
1432 the example above it would be::
1433
1434 [
1435 ("12 passed", {"green": True}),
1436 ("2 errors", {"red": True}
1437 ]
1438
1439 That last dict for each line is a "markup dictionary", used by TerminalWriter to
1440 color output.
1441
1442 The final color of the line is also determined by this function, and is the second
1443 element of the returned tuple.
1444 """
1445 if self.config.getoption("collectonly"):
1446 return self._build_collect_only_summary_stats_line()
1447 else:
1448 return self._build_normal_summary_stats_line()
1449
1450 def _get_reports_to_display(self, key: str) -> list[Any]:
1451 """Get test/collection reports for the given status key, such as `passed` or `error`."""

Callers 3

summary_statsMethod · 0.95
test_summary_statsFunction · 0.80

Tested by 2

test_summary_statsFunction · 0.64