MCPcopy Index your code
hub / github.com/streamlit/streamlit / _aggregate_flaky_tests

Function _aggregate_flaky_tests

scripts/fetch_flaky_tests.py:137–164  ·  view source on GitHub ↗

Aggregate flaky tests across runs and count total reruns.

(
    all_flaky_tests: list[dict[str, Any]],
)

Source from the content-addressed store, hash-verified

135
136
137def _aggregate_flaky_tests(
138 all_flaky_tests: list[dict[str, Any]],
139) -> list[dict[str, Any]]:
140 """Aggregate flaky tests across runs and count total reruns."""
141 rerun_counts: Counter[str] = Counter()
142 browser_rerun_counts: Counter[str] = Counter()
143 browser_info: dict[str, set[str]] = {}
144
145 for test in all_flaky_tests:
146 normalized = _normalize_test_name(test["nodeid"])
147 rerun_counts[normalized] += test["rerun_count"]
148 browser_rerun_counts[normalized] += (
149 1 # Counts browser-specific entries, not distinct CI runs
150 )
151 browser_info.setdefault(normalized, set()).add(test["browser"])
152
153 results = [
154 {
155 "nodeid": nodeid,
156 "total_reruns": total_reruns,
157 "browser_rerun_count": browser_rerun_counts[nodeid],
158 "browsers": sorted(browser_info[nodeid]),
159 }
160 for nodeid, total_reruns in rerun_counts.items()
161 ]
162
163 results.sort(key=_sort_key)
164 return results
165
166
167def main() -> None:

Callers 1

mainFunction · 0.85

Calls 4

_normalize_test_nameFunction · 0.85
addMethod · 0.80
setdefaultMethod · 0.80
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…