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
@@ -30,8 +30,8 @@ class ModelsOfARun(unittest.TestCase):
def setUp(self):
temp = tempfile.TemporaryDirectory()
self.addCleanup(temp.cleanup)
self.paths = paths_from(pathlib.Path(temp.name))
self.paths.models_file.parent.mkdir()
self.paths = paths_from(pathlib.Path(temp.name), {})
self.paths.models_file.parent.mkdir(parents=True)
def test_a_run_that_names_both_models_reads_no_models_file_and_asks_nothing(self):
self.paths.models_file.write_text("not json")
@@ -76,17 +76,17 @@ class SavingAModel(unittest.TestCase):
def setUp(self):
temp = tempfile.TemporaryDirectory()
self.addCleanup(temp.cleanup)
self.paths = paths_from(pathlib.Path(temp.name))
self.lock = self.paths.home / ".local/state/loop-claude/models.lock"
self.paths = paths_from(pathlib.Path(temp.name), {})
self.lock = self.paths.home / ".local/state/build-release/claims/models.lock"
def test_adds_the_projects_model_to_those_the_file_holds(self):
self.paths.models_file.parent.mkdir()
self.paths.models_file.parent.mkdir(parents=True)
self.paths.models_file.write_text(json.dumps({"other": "model-x"}))
self.assertIsNone(model_choice.save_model("proj", "model-b", self.paths, replace_file))
self.assertEqual(json.loads(self.paths.models_file.read_text()), {"other": "model-x", "proj": "model-b"})
def test_writes_the_file_for_a_human_to_merge_into_a_project_per_tab_indented_line_in_the_order_of_their_keys(self):
self.paths.models_file.parent.mkdir()
self.paths.models_file.parent.mkdir(parents=True)
self.paths.models_file.write_text(json.dumps({"zebra": "model-z", "other": "model-x"}))
self.assertIsNone(model_choice.save_model("proj", "model-b", self.paths, replace_file))
self.assertEqual(self.paths.models_file.read_text(), '{\n\t"other": "model-x",\n\t"proj": "model-b",\n\t"zebra": "model-z"\n}')
@@ -100,7 +100,7 @@ class SavingAModel(unittest.TestCase):
return False
def test_holds_the_models_lock_from_its_read_to_its_write(self):
self.paths.models_file.parent.mkdir()
self.paths.models_file.parent.mkdir(parents=True)
held = []
class Watched(pathlib.PosixPath):
@@ -119,7 +119,7 @@ class SavingAModel(unittest.TestCase):
self.assertFalse(self.lock_is_held())
def test_doesnt_save_anything_where_it_cannot_take_the_lock(self):
self.paths.models_file.parent.mkdir()
self.paths.models_file.parent.mkdir(parents=True)
self.lock.parent.parent.mkdir(parents=True)
self.lock.parent.write_text("")
saved = model_choice.save_model("proj", "model-b", self.paths, replace_file)
@@ -128,7 +128,7 @@ class SavingAModel(unittest.TestCase):
self.assertFalse(self.paths.models_file.exists())
def test_a_pick_is_saved_through_save_model_alone(self):
self.paths.models_file.parent.mkdir()
self.paths.models_file.parent.mkdir(parents=True)
fake, held = FakeEffects(inputs=["my-model"]), []
def replace(path: pathlib.Path, data: bytes) -> Failure: