diff --git a/goodwe_controller/test_rehearse.py b/goodwe_controller/test_rehearse.py index 7114a3c..e919e57 100644 --- a/goodwe_controller/test_rehearse.py +++ b/goodwe_controller/test_rehearse.py @@ -283,9 +283,18 @@ for mid, control, what, edits, must_say in MUTATIONS: print() print(f" --- {mid} ({control}) {what}") print(f" exit {code} (0=clean 1=finding 2=could-not-run)") + # ⚠️ THE FINDINGS, DE-DUPLICATED AND IN ORDER. The tool prints each finding + # once per transition leg and once more in its summary, and its own header + # is full of ⚠️ paragraphs - printing every line that starts with one would + # bury the evidence this part exists to show under the tool's docstring. + seen = [] for line in out.splitlines(): - if line.strip().startswith("⚠️ "): - print(f" {line.strip()[:150]}") + text = line.strip() + if text.startswith("⚠️ ") and re.match(r"⚠️ [A-Z][A-Z -]+[A-Z()]:", text): + if text not in seen: + seen.append(text) + for text in seen: + print(f" {text[:160]}") check(f"{mid} turns {control} RED", red) check(f"{mid} says WHY, and it is the right why: {must_say!r}", named) shutil.rmtree(Path(tree).parent, ignore_errors=True)