Skip to content

Commit 6eb820c

Browse files
authored
Merge pull request #346 from CCPBioSim/345-general-limit-updated-regression-baselines-to-grouped-result-data
Store grouped-only regression baselines and run slow cases in update workflow
2 parents 748481d + cce34e9 commit 6eb820c

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

.github/workflows/update_regression_baselines.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
python -m pip install -e .[testing]
3434
3535
- name: Update regression baselines
36-
run: pytest tests/regression --update-baselines
36+
run: pytest tests/regression --update-baselines --run-slow
3737

3838
- name: Commit updated baselines
3939
uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6

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)