Skip to content

Commit af9dd23

Browse files
committed
tests(regression): update test_regression.py to only update regression test results
1 parent 748481d commit af9dd23

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

tests/regression/test_regression.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ def _group_index(payload: dict[str, Any]) -> dict[str, dict[str, Any]]:
5151
return groups
5252

5353

54+
def _baseline_payload(payload: dict[str, Any]) -> dict[str, Any]:
55+
"""
56+
Build the persisted regression baseline payload.
57+
58+
Baselines intentionally store only grouped entropy results, not runtime
59+
arguments or provenance, so they remain stable across machines and runs.
60+
"""
61+
return {
62+
"groups": _group_index(payload),
63+
}
64+
65+
5466
def _compare_grouped(
5567
*,
5668
got_payload: dict[str, Any],
@@ -148,7 +160,8 @@ def test_regression_matches_baseline(
148160
options.
149161
150162
Raises:
151-
AssertionError: If the output does not match the baseline or baseline is missing
163+
AssertionError: If the output does not match the baseline or
164+
baseline is missing.
152165
"""
153166
system = case.system
154167
config_path = case.config_path
@@ -176,7 +189,9 @@ def test_regression_matches_baseline(
176189

177190
if request.config.getoption("--update-baselines"):
178191
baseline_path.parent.mkdir(parents=True, exist_ok=True)
179-
baseline_path.write_text(json.dumps(run.payload, indent=2))
192+
baseline_path.write_text(
193+
json.dumps(_baseline_payload(run.payload), indent=2) + "\n"
194+
)
180195
pytest.skip(f"Updated baseline for {system}")
181196

182197
_compare_grouped(

0 commit comments

Comments
 (0)