test: use an isolated real ledger for Chronos claim rearming

This commit is contained in:
Teknium
2026-09-07 03:50:11 -07:00
parent 96a903c9d2
commit 567d53db23
+4 -5
View File
@@ -136,8 +136,11 @@ def test_fire_due_rearms_next_oneshot(chronos, monkeypatch):
assert fake.provisions[0]["fire_at"] == "2026-06-18T12:05:00+00:00"
def test_fire_due_rearms_after_claimed_job_failure(chronos, monkeypatch):
def test_fire_due_rearms_after_claimed_job_failure(chronos, monkeypatch, tmp_path):
"""A claimed attempt is consumed even when the job pipeline reports failure."""
import cron.executions as executions
monkeypatch.setattr(executions, "EXECUTIONS_FILE", tmp_path / "executions.db")
prov, fake = chronos
claimed = {"id": "j1", "fire_claim": {"by": "owner-1"}}
persisted = {
@@ -147,10 +150,6 @@ def test_fire_due_rearms_after_claimed_job_failure(chronos, monkeypatch):
}
monkeypatch.setattr("cron.jobs.claim_job_for_fire", lambda jid, **kw: claimed)
monkeypatch.setattr(
"cron.executions.create_execution",
lambda jid, source: {"id": "exec-1"},
)
monkeypatch.setattr("cron.scheduler.run_one_job", lambda *args, **kwargs: False)
monkeypatch.setattr("cron.jobs.get_job", lambda jid: persisted)