Skip to content

The agent that grows with you

test: use an isolated real ledger for Chronos claim rearming

Teknium567d53db23f4
diff --git a/tests/plugins/test_chronos_cron.py b/tests/plugins/test_chronos_cron.py
index a98ad246283..97486632bfb 100644
--- a/tests/plugins/test_chronos_cron.py
+++ b/tests/plugins/test_chronos_cron.py
@@ -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)