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

Method collapsed_location_report

src/_pytest/terminal.py:1107–1123  ·  view source on GitHub ↗
(reports: list[WarningReport])

Source from the content-addressed store, hash-verified

1105 reports_grouped_by_message.setdefault(wr.message, []).append(wr)
1106
1107 def collapsed_location_report(reports: list[WarningReport]) -> str:
1108 locations = []
1109 for w in reports:
1110 location = w.get_location(self.config)
1111 if location:
1112 locations.append(location)
1113
1114 if len(locations) < 10:
1115 return "\n".join(map(str, locations))
1116
1117 counts_by_filename = Counter(
1118 str(loc).split("::", 1)[0] for loc in locations
1119 )
1120 return "\n".join(
1121 "{}: {} warning{}".format(k, v, "s" if v > 1 else "")
1122 for k, v in counts_by_filename.items()
1123 )
1124
1125 title = "warnings summary (final)" if final else "warnings summary"
1126 self.write_sep("=", title, yellow=True, bold=False)

Callers

nothing calls this directly

Calls 4

get_locationMethod · 0.80
appendMethod · 0.80
joinMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected