refactor: print the autorun plan in the command

This commit is contained in:
Abdessamad Derraz committed 2026-11-22 00:58:05 +01:00
1 parent e77cf9fd69
commit 936e9ceed9
3 files changed
+29 -10

No files matched your search

+8 -4
View File
@@ -9,8 +9,6 @@ from __future__ import annotations
import tests
import contextlib
import io
import json
import os
import shutil
@@ -195,6 +193,13 @@ class Guards(Scratch):
self.assertIn("GB free", detail)
self.assertFalse((ctx.repo / "ran").exists())
def test_an_unknown_job_raises_and_records_nothing(self):
ctx = self.context({"x": {"worktree": False, "min_free_gb": 0, "steps": []}})
with self.assertRaises(runner.UnknownJob) as caught:
runner.run_job(ctx, "y")
self.assertEqual(str(caught.exception), "unknown job 'y': x")
self.assertFalse(ctx.state_path.exists())
def test_a_failure_counts_and_a_success_resets(self):
ctx = self.context({
"bad": {"worktree": False, "min_free_gb": 0, "steps": [[PY, "-c", "raise SystemExit(3)"]]},
@@ -517,8 +522,7 @@ class Commits(Origin):
jobs=unattended_jobs.parse_jobs({"jobs": {"n": {"commits": [{
"subject": "chore: regenerate collection records",
"paths": ["database.json", "install/*.json"]}]}}}))
with contextlib.redirect_stdout(io.StringIO()):
self.assertEqual(runner.run_job(ctx, "n"), (unattended_jobs.OK, "dry run"))
self.assertEqual(runner.run_job(ctx, "n"), (unattended_jobs.OK, "dry run"))
lines = runner.describe(ctx.jobs["n"], ctx)
would = sorted(line.split("would commit ")[1] for line in lines if "would commit" in line)
self.assertEqual(would, ["database.json", "install/b.json"])