From 10abbaff9fdca341798bd461c4999a451ed171a9 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 22 Oct 2026 01:59:19 +0200 Subject: [PATCH] =?UTF-8?q?Answer=20stability=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1;=20test=20the=20refusal=20on?= =?UTF-8?q?=20a=20ref=20that=20doesn't=20exist=20instead=20of=20a=20mock,?= =?UTF-8?q?=20and=20say=20why=20only=20Next=20names=20a=20release=20to=20e?= =?UTF-8?q?mpty?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/larv_review/plan.py | 4 ++-- bin/larv_review/test_larv_review.py | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/bin/larv_review/plan.py b/bin/larv_review/plan.py index 9cacc4ed..261483cb 100644 --- a/bin/larv_review/plan.py +++ b/bin/larv_review/plan.py @@ -30,11 +30,11 @@ def work_landed(release: tuple[int, int, int], shipped: list[Item], landed: tupl def landed_towards(found: list[Item], cut: LastCut) -> tuple[int, int, int] | None | Failure: - """The release unreleased changes on the default branch have landed towards: the next release, as chunk-preflight names it (`chunk_pick.chunk_item`), where `chunk_pick.unreleased_changes` counts one or more. None where there is no such release or no such change; a Failure where either cannot be read. found is the default branch's plan.""" + """The release unreleased changes on the default branch have landed towards: the next release, as chunk-preflight names it (`chunk_pick.chunk_item`), where it holds items and `chunk_pick.unreleased_changes` counts one or more. None otherwise; a Failure where either cannot be read. found is the default branch's plan.""" pick = chunk_item(found, cut) if isinstance(pick, Unknown): return Failure("could not tell the next release from the default branch's tags and todo.md history") - # Next is the one pick with a release that holds items; Cut, Finished and Unplanned have none to empty. + # Only Next names a release a chunk can empty after work landed: Cut's is already cut, and Finished's and Unplanned's hold no item. if not isinstance(pick, Next): return None changes = unreleased_changes(cut) diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index 57e89c79..5517d1db 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -1,6 +1,5 @@ import decimal import itertools -from unittest import mock import os import pathlib import subprocess @@ -15,11 +14,11 @@ from larv_review.agreement import agreement_report, ruling_agreement, run_agreem from comprehension_history import appended, entries, HistoryChange, latest_places, Place, recorded, ruling_entry, scoring_entry, ScoringRun, Seat import comprehension_history from larv_review.ruling import counted, ruling, split, votes -from chunk_pick import DefaultPlan, LastCut from failure import Failure from test_env import isolated_env from todo_table import Item, items, NoItemsTable from larv_review.plan import landed_towards, plan_reasons, scoring_run_due +from chunk_pick import LastCut from larv_review.scoring import means, under_floor from larv_review.ruling_base import measured_commit from larv_review.seats import score_line, scores, seats_file @@ -319,7 +318,7 @@ class LandedTowards(unittest.TestCase): self.assertEqual(landed_towards(plan, LastCut("v0.1.0", "", 3, [])), (0, 2, 0)) self.assertEqual(landed_towards(plan, LastCut(None, "", 0, [])), None) - def test_names_no_release_where_chunk_preflight_names_none_that_holds_items(self): + def test_names_no_release_where_chunk_preflight_names_none_a_chunk_can_empty(self): changelog = "# Changelog\n\n## Unreleased\n\n- Did a thing.\n" self.assertIsNone(landed_towards([item(1, (0, 1, 0))], LastCut("v0.1.0", changelog, 0, []))) self.assertIsNone(landed_towards([], LastCut("v0.1.0", changelog, 0, [""]))) @@ -417,11 +416,9 @@ class LarvReviewTool(unittest.TestCase): self.assertEqual(self.run_tool("needs-scoring-run").stdout, "Scoring run due: the chunk leaves release 0.1.0 with no plan item.\n") def test_refuses_where_the_default_branchs_unreleased_changes_cannot_be_read(self): - unreadable = DefaultPlan((self.checkout / "todo.md").read_text(), LastCut("v0.0.1", Failure("changelog unreadable"), Failure("count unreadable"), [])) self.addCleanup(os.chdir, os.getcwd()) os.chdir(self.checkout) - with mock.patch("larv_review.plan.default_plan", return_value=unreadable): - self.assertEqual(plan_reasons("main", []), Failure("count unreadable")) + self.assertIsInstance(plan_reasons("no-such-ref", []), Failure) def test_refuses_a_checkout_plan_whose_renamed_section_does_not_parse(self): self.commit("Break the mark", {"todo.md": todo("| 1 | 0.2.0 | | **Do it.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |") + "\n## Renamed\n\nsoon\n"})