Kill the surviving mutants of claudeMdExcludes and wait-for's half-line cut
CI / tests (pull_request) Successful in 2m11s
CI / tests (pull_request) Successful in 2m11s
This commit is contained in:
@@ -9,7 +9,7 @@ import unittest
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from larv_review.scoring_setup import bullets, file_globs, preloaded_files, prepare_scoring, project_values, score_bullets, section
|
||||
from larv_review.scoring_setup import bullets, CLAUDE_MD, file_globs, preloaded_files, prepare_scoring, project_values, score_bullets, section
|
||||
from failure import Failure
|
||||
from test_env import isolated_env
|
||||
|
||||
@@ -154,6 +154,23 @@ class PrepareScoring(unittest.TestCase):
|
||||
(self.checkout / ".claude" / "settings.json").write_text('{"claudeMdExcludes": [3]}\n')
|
||||
self.assertEqual(preloaded_files(self.checkout, self.root), f"`~/.claude/CLAUDE.md` and `~/.claude/rules/{rule}.md`")
|
||||
|
||||
def test_reads_the_excludes_of_both_settings_files_and_names_none_where_nothing_loads(self):
|
||||
(self.root / ".claude").mkdir()
|
||||
(self.root / ".claude" / "CLAUDE.md").write_text("# Home\n")
|
||||
(self.checkout / "CLAUDE.md").write_text("# Project\n")
|
||||
(self.checkout / ".claude").mkdir()
|
||||
settings, local = self.checkout / ".claude" / "settings.json", self.checkout / ".claude" / "settings.local.json"
|
||||
for first, second in (("not json", '{"claudeMdExcludes": ["**/.claude/*.md", "**/proj/*.md"]}'), ('{"claudeMdExcludes": ["**/.claude/*.md"]}', '{"claudeMdExcludes": ["**/proj/*.md"]}')):
|
||||
with self.subTest(first=first):
|
||||
settings.write_text(first)
|
||||
local.write_text(second)
|
||||
self.assertEqual(preloaded_files(self.checkout, self.root), "none")
|
||||
for odd in ("[1]", '{"claudeMdExcludes": 3}'):
|
||||
with self.subTest(odd=odd):
|
||||
settings.write_text(odd)
|
||||
local.write_text(odd)
|
||||
self.assertEqual(preloaded_files(self.checkout, self.root), f"`~/.claude/{CLAUDE_MD}` and `{CLAUDE_MD}`")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -69,6 +69,20 @@ class WaitFor(unittest.TestCase):
|
||||
self.assertEqual(main.waited(str(self.file), None, 60, clock), "No findings.")
|
||||
self.assertEqual(clock.now, main.POLL_SECONDS)
|
||||
|
||||
def test_takes_a_whole_line_at_once_beside_a_half_written_one(self):
|
||||
self.file.write_text("a\nb\npart")
|
||||
clock = Clock()
|
||||
self.assertEqual(main.waited(str(self.file), "b", 60, clock), "b")
|
||||
self.assertEqual(clock.now, 0)
|
||||
self.file.write_text("done\n")
|
||||
self.assertEqual(main.waited(str(self.file), None, 60, clock), "done")
|
||||
self.assertEqual(clock.now, 0)
|
||||
|
||||
def test_matches_no_part_of_a_half_written_first_line(self):
|
||||
self.file.write_text("part")
|
||||
clock = Clock(lambda: self.file.write_text("partial\n"))
|
||||
self.assertEqual(main.waited(str(self.file), "p", 60, clock), "partial")
|
||||
|
||||
def test_reads_a_line_that_is_not_utf_8(self):
|
||||
self.file.write_bytes(b"caf\xe9 passed\n")
|
||||
self.assertEqual(main.waited(str(self.file), "passed", 60, Clock()), "caf\ufffd passed")
|
||||
|
||||
Reference in New Issue
Block a user