diff --git a/tests/test_patching.py b/tests/test_patching.py index 23e4ccf..b7afad8 100644 --- a/tests/test_patching.py +++ b/tests/test_patching.py @@ -38,6 +38,13 @@ READ_KNOB = ROOT / "skills" / "patching-hosts" / "scripts" / "read-knob.sh" TUE = "window Tue 05:00-10:00\n" +#: The day the parse-agreement fixtures are read on: the day before their dated +#: window, so the case doesn't rest on how the reader treats the window's own day. +#: The reader reports a dated window as ``past-window`` from the day after the one +#: it closes on, so a fixed date keeps the case about the parse, not the calendar +#: (#160). The committed knob is read on the real date: a past window there is a +#: real finding. +FIXTURE_TODAY = "2026-11-30" #: Tuesday 2026-11-10, the first window under #113. OPEN = datetime(2026, 11, 10, 5, 0, tzinfo=UTC) CLOSE = datetime(2026, 11, 10, 10, 0, tzinfo=UTC) @@ -133,9 +140,11 @@ def test_no_weekday_window_is_unreadable(self): parse_windows("window 2026-11-03 15:37-17:37\n") -def _read_knob(path: Path) -> list[tuple]: +def _read_knob(path: Path, today: str | None = None) -> list[tuple]: + """The skill's reading of the knob at PATH, checked as of TODAY (default: today, UTC).""" + args = ["bash", str(READ_KNOB), "--config", str(path), "--host", "co-processor"] out = subprocess.run( - ["bash", str(READ_KNOB), "--config", str(path), "--host", "co-processor"], + args + (["--today", today] if today is not None else []), capture_output=True, text=True, check=True, @@ -178,7 +187,7 @@ def test_the_parse_agrees_with_the_skills_reader(tmp_path, text): assert READ_KNOB.is_file(), f"{READ_KNOB} missing: run `bash .skills/doctor.sh`" knob = tmp_path / "knob" knob.write_text("class production\nposture automatic\n" + text) - assert _ours(knob.read_text()) == _read_knob(knob) + assert _ours(knob.read_text()) == _read_knob(knob, today=FIXTURE_TODAY) def test_the_committed_knob_agrees_with_the_skills_reader():