Keep configs in ~/.config/build-release/ and tool state in ~/.local/state/build-release/, under XDG_* where set
CI / tests (pull_request) Successful in 6m34s

This commit is contained in:
2026-12-03 18:56:28 +01:00
parent 20c83f861f
commit 1ca2c8efe0
142 changed files with 1095 additions and 933 deletions
+2 -2
View File
@@ -107,12 +107,12 @@ NAMED = {"release": "Release", "blocked_by": BLOCKED_BY, "exempt": "Exempt", "ta
# plan_of is plan_store, except in the tests of a plan in Jira, which hand it a plan in memory.
def main(argv: list[str], folder: pathlib.Path, home: pathlib.Path, stdin: typing.TextIO, plan_of: typing.Callable[[ProjectConfig], PlanStore] = plan_store) -> int:
def main(argv: list[str], folder: pathlib.Path, home: pathlib.Path, env: typing.Mapping[str, str], stdin: typing.TextIO, plan_of: typing.Callable[[ProjectConfig], PlanStore] = plan_store) -> int:
if argv[:1] in (["-h"], ["--help"]):
print(__doc__.strip())
return 0
args = parser().parse_args(argv)
config = located(str(folder), home)
config = located(str(folder), home, env)
if isinstance(config, Failure):
done: str | Failure = config
else:
+6 -6
View File
@@ -40,7 +40,7 @@ class TodoItem(unittest.TestCase):
self.addCleanup(temp.cleanup)
self.folder = pathlib.Path(temp.name)
self.config = configured(self, self.folder) / "config.toml"
self.home = self.config.parents[2]
self.home = self.config.parents[3]
# The plan main is handed in place of the one the config names.
self.plan_of = {}
self.todo = self.folder / "todo.md"
@@ -54,16 +54,16 @@ class TodoItem(unittest.TestCase):
def run_main(self, *argv, stdin: str | io.StringIO = ""):
with contextlib.redirect_stdout(io.StringIO()) as out, contextlib.redirect_stderr(io.StringIO()) as err:
code = main.main(list(argv), self.folder, self.home, io.StringIO(stdin) if isinstance(stdin, str) else stdin, **self.plan_of)
code = main.main(list(argv), self.folder, self.home, {}, io.StringIO(stdin) if isinstance(stdin, str) else stdin, **self.plan_of)
return code, out.getvalue(), err.getvalue()
def exit_code(self, *argv):
with contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(io.StringIO()), self.assertRaises(SystemExit) as raised:
main.main(list(argv), self.folder, self.home, io.StringIO())
main.main(list(argv), self.folder, self.home, {}, io.StringIO())
return raised.exception.code
def assert_ranked(self):
self.assertEqual(file_plan(located(str(self.folder), self.home), self.todo).check(), [])
self.assertEqual(file_plan(located(str(self.folder), self.home, {}), self.todo).check(), [])
def details(self):
text = self.todo.read_text()
@@ -409,7 +409,7 @@ class List(TodoItem):
def test_fails_on_a_release_that_is_no_version(self):
errors = io.StringIO()
with contextlib.redirect_stderr(errors), self.assertRaises(SystemExit) as raised:
main.main(["list", "--release", "next"], self.folder, self.home, io.StringIO())
main.main(["list", "--release", "next"], self.folder, self.home, {}, io.StringIO())
self.assertEqual(raised.exception.code, 2)
self.assertIn("argument --release: 'next' is not a semver version", errors.getvalue())
@@ -536,7 +536,7 @@ class Move(TodoItem):
class OtherFile(TodoItem):
def test_ranking_works_on_the_file_it_is_given_not_the_configured_plan(self):
config = located(str(self.folder), self.home)
config = located(str(self.folder), self.home, {})
other = self.folder / "other.md"
other.write_text("not a plan\n")
self.assertNotEqual(file_plan(config, other).check(), [])