diff --git a/sisi/models.py b/sisi/models.py index 0b55c5c..9daa67d 100644 --- a/sisi/models.py +++ b/sisi/models.py @@ -431,6 +431,7 @@ def pick(args, cwd=None, rand=None): clock(g[0]), g[1][:160] + ("…" if len(g[1]) > 160 else ""))) from . import plan print(plan.record_line()) + node or print(plan.REACH_LINE) also and print("this worker already runs node %s: judge with --node %s" % (", ".join(also), node)) if node and sid: with store.session(sid) as s: print(plan.header(s["plan"], node)) diff --git a/tests/test_plan.py b/tests/test_plan.py index cfd705d..f311813 100644 --- a/tests/test_plan.py +++ b/tests/test_plan.py @@ -156,6 +156,20 @@ class Plan(unittest.TestCase): self.assertIn("reach: make this 100x faster", out) self.assertIn(plan.REACH_LINE, out) + def test_pick_without_a_node_prints_the_reach_line_but_no_reach(self): + from sisi import plan + self.table(TABLE) + rc, out, _ = self.sisi("pick", "routine") + self.assertEqual(rc, 0, out) + self.assertIn(plan.REACH_LINE, out) + self.assertEqual([l for l in out.splitlines() if l.startswith("reach:")], [], out) + self.ready_plan(text=REACH + ( + "| a | routine | - | p-a | sisi/a.py | test a passes | make this 100x faster | exact spec |\n" + "| b | ordinary | - | p-b | sisi/b.py | test b passes | | some judgement |\n" + "| join | lead | a, b | - | - | full suite passes | | the lead merges |\n")) + out = self.pick("a") + self.assertEqual(out.count(plan.REACH_LINE), 1, out) + def test_record_line_counts_the_last_twenty_judged_per_class(self): self.table(TABLE) line = lambda w, v: json.dumps({"ts": "2026-11-20T10:00:00", "worker": w, "verdict": v, "why": "did it fine"})