Answer principles round 1: 0 🔴, 3 🟡 (0 misread); state listed's lock, let each module drop its own ended files, test run_loop's listing end to end
This commit is contained in:
@@ -344,16 +344,17 @@ class Waiting(unittest.TestCase):
|
||||
waiting.drop_ended(folder)
|
||||
self.assertEqual(asks_and_answers(folder), [])
|
||||
|
||||
def test_loop_inbox_removes_a_killed_loops_ask_and_answer_as_it_looks(self):
|
||||
def test_loop_inbox_removes_a_killed_loops_ask_answer_and_running_file_as_it_looks(self):
|
||||
with tempfile.TemporaryDirectory() as home:
|
||||
paths = paths_from(pathlib.Path(home))
|
||||
ask = asked("s1", "/a")
|
||||
waiting.publish(paths.waiting, ask)
|
||||
waiting.send(paths.waiting, ask, Typed("Use A."))
|
||||
running_loops.running_file(paths.waiting, "s1").write_text(json.dumps({"root": "/a", "items": []}))
|
||||
main.run(Window("q"), contextlib.nullcontext, paths, system_effects())
|
||||
self.assertEqual(asks_and_answers(paths.waiting), [])
|
||||
|
||||
def test_removes_only_the_asks_answers_and_running_files_whose_loop_has_ended(self):
|
||||
def test_removes_only_the_asks_answers_and_running_files_whose_loop_has_ended_each_by_its_own_module(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
folder = pathlib.Path(temp)
|
||||
loops_hold(self, folder, "s1")
|
||||
@@ -363,6 +364,8 @@ class Waiting(unittest.TestCase):
|
||||
for session in ("s1", "s2", "s3"):
|
||||
running_loops.running_file(folder, session).write_text(json.dumps({"root": "/a", "items": []}))
|
||||
waiting.drop_ended(folder)
|
||||
self.assertEqual(asks_and_answers(folder), ["s1.answer", "s1.json", "s1.running", "s2.running", "s3.running"])
|
||||
running_loops.drop_ended_loops(folder)
|
||||
self.assertEqual(asks_and_answers(folder), ["s1.answer", "s1.json", "s1.running"])
|
||||
|
||||
def test_a_talk_claim_from_pid_0_or_below_is_no_answer_since_it_would_name_a_process_group(self):
|
||||
@@ -453,11 +456,6 @@ class RunningLoops(unittest.TestCase):
|
||||
with running_loops.shown_running(self.folder, "s1", "/code/log", dataclasses.replace(self.effects, sleep=lambda seconds: looking.close())):
|
||||
self.assertEqual(running_loops.running_loops(self.folder), [RunningLoop("s1", "/code/log", ())])
|
||||
|
||||
def test_a_chunk_takes_its_routed_item_first_then_those_taken_in_once_each(self):
|
||||
self.assertEqual(running_loops.taken_items(Failure("no todo.md"), 12, (14, 12, 3)), (Taken(12, ""), Taken(14, ""), Taken(3, "")))
|
||||
self.assertEqual(running_loops.taken_items(Failure("no todo.md"), 0, (14,)), (Taken(14, ""),))
|
||||
self.assertEqual(running_loops.taken_items(Failure("no todo.md"), 0, ()), ())
|
||||
|
||||
|
||||
class Shown(unittest.TestCase):
|
||||
def drawn(self, screen, window):
|
||||
|
||||
Reference in New Issue
Block a user