Edit a Jira issue the loop filed, and score a teammate's with a comment saying why
CI / tests (pull_request) Successful in 1m48s

This commit is contained in:
2026-11-16 01:55:57 +01:00
parent 0681e9be17
commit 2e9d9dd714
13 changed files with 326 additions and 27 deletions
+14 -1
View File
@@ -4,6 +4,7 @@ import pathlib
import sys
import tempfile
import unittest
import unittest.mock
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent.parent))
@@ -14,7 +15,7 @@ from todo_item import edits, main
from failure import Failure
from project_config.main import located
from release_plan import plan_file, ranking
from plan_store.stores import plan_of
from plan_store.stores import plan_of, Written
from todo_item.table import table
ADD = ["add", "--release", "0.1.0", "--l", "1", "--e", "1", "--i", "1", "--s", "1", "--moves", "1 by 9", "Count the `a | b` runs."]
@@ -415,6 +416,18 @@ class Edit(TodoItem):
def test_refuses_an_edit_that_changes_nothing(self):
self.assertEqual(self.run_main("edit", "3"), (1, "", "not edited: no flag names a change; todo-item --help lists them\n"))
self.assertEqual(self.run_main("edit", "3", "--comment", "Why.")[::2], (1, "not edited: no flag names a change; todo-item --help lists them\n"))
def test_an_edit_hands_the_comment_to_the_plan(self):
for argv, comment in ((["--comment", "A small change."], "A small change."), ([], None)):
with self.subTest(argv=argv):
plan = unittest.mock.Mock(label="the plan", edit=unittest.mock.Mock(return_value=Written(3)))
self.assertEqual(main.edit(main.parser().parse_args(["edit", "3", "--l", "3", *argv]), plan, ""), "Edited item 3 in the plan.")
plan.edit.assert_called_once_with(3, {"L": "3"}, None, comment)
def test_a_plan_in_a_file_takes_an_edit_with_a_comment_and_keeps_no_comment(self):
self.assertEqual(self.run_main("edit", "3", "--l", "3", "--comment", "A small change.")[:2], (0, f"Edited item 3 in {self.todo}.\n"))
self.assertNotIn("A small change.", self.todo.read_text())
def test_leaves_the_file_ranked(self):
self.run_main("edit", "1", "--s", "2", "--moves", "1 by 10")