Files
C.E.L_Slide_test2/tests/scripts/test_update_status_board.py
kyeongmin c59864eb9a
Some checks failed
Multi-MDX Regression (IMP-91) / multi-mdx-regression (push) Failing after 31s
feat(#91): IMP-91 u2~u15 multi-mdx regression CI suite + status-board auto-update
- u2~u5: tests/integration/test_multi_mdx_regression.py — MDX_SET=(01..05)
  cached integration runs + status/structural/visual snapshots +
  full_mdx_coverage assertion (9 snapshots populated for 01-05).
- u6~u11: F0 normalize / F1 V4 ranking / F2 slot_payload /
  F3 classifier-only AI / F4 layout / F5 final.html axis per MDX_SET.
- u12: pyproject.toml — pytest-json-report>=1.5 in dev extras.
- u13: .github/workflows/multi-mdx-regression.yml — pytest+artifact CI.
- u14: scripts/update_status_board.py + tests/scripts/test_update_status_board.py
  — idempotent JSON marker updater (3 unit tests pass).
- u15: PHASE-Z-PIPELINE-STATUS-BOARD.md — 30 F0-F5 × mdx01-05 markers
  initialized `?` + workflow wiring.

Stage 4 verify: 59/59 PASS targeted (smoke 6 + updater 3 + integration 50),
386/386 PASS regression umbrella, 0 failures.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 07:01:58 +09:00

63 lines
2.1 KiB
Python

"""IMP-#91 u14 — unit tests for the status-board marker updater.
Exercises ``parse_outcomes`` (nodeid → axis/mdx outcome mapping) and
``update_board_text`` (idempotent marker rewrite). u15 will wire the CLI
into the GitHub Actions workflow; these tests guard the contract.
"""
from __future__ import annotations
import sys
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(REPO_ROOT / "scripts"))
import update_status_board as usb # noqa: E402
SAMPLE_REPORT = {
"tests": [
{
"nodeid": "tests/integration/test_multi_mdx_regression.py::test_normalize_snapshot_matches[01]",
"outcome": "passed",
},
{
"nodeid": "tests/integration/test_multi_mdx_regression.py::test_v4_ranking_snapshot_matches[02]",
"outcome": "passed",
},
{
"nodeid": "tests/integration/test_multi_mdx_regression.py::test_layout_snapshot_matches[03]",
"outcome": "failed",
},
{
"nodeid": "tests/integration/test_multi_mdx_regression.py::test_pipeline_run_produces_step20_status[02]",
"outcome": "passed",
},
]
}
def test_parse_outcomes_maps_known_axes_only() -> None:
outcomes = usb.parse_outcomes(SAMPLE_REPORT)
assert outcomes == {
("F0", "01"): "PASS",
("F1", "02"): "PASS",
("F4", "03"): "FAIL",
}
def test_update_board_text_rewrites_markers() -> None:
board = "F0/01: <!-- IMP-91:F0:01 -->?<!-- /IMP-91 --> F1/02: <!-- IMP-91:F1:02 -->old<!-- /IMP-91 -->"
outcomes = {("F0", "01"): "PASS"}
result = usb.update_board_text(board, outcomes)
assert "<!-- IMP-91:F0:01 -->PASS<!-- /IMP-91 -->" in result
assert "<!-- IMP-91:F1:02 -->?<!-- /IMP-91 -->" in result
def test_update_board_text_is_idempotent() -> None:
board = "<!-- IMP-91:F2:05 -->old<!-- /IMP-91 -->"
outcomes = {("F2", "05"): "PASS"}
once = usb.update_board_text(board, outcomes)
twice = usb.update_board_text(once, outcomes)
assert once == twice == "<!-- IMP-91:F2:05 -->PASS<!-- /IMP-91 -->"