32k pixel as hard group limit, better manual resolution support

This commit is contained in:
sebastien committed 2026-09-22 11:42:16 +02:00
1 parent a9c0703f03
commit 5009831c7c
9 files changed
+322 -58

No files matched your search

+60 -5
View File
@@ -150,6 +150,56 @@ class GuiConvenienceTests(unittest.TestCase):
self.app.update()
self.assertEqual(self.app.current_step.id, "fetch_batches")
def test_batch_retrieval_success_selects_integration_without_starting_it(self):
self.app.state_store.update_step("correction", variant="batch", last_run_variant="batch")
self.app._populate_tree()
self.app.tree.selection_set("fetch_batches")
self.app.update()
self.app.active_step_id = "fetch_batches"
with patch.object(self.app.runner, "start") as start:
self.app._finish_process(0, False)
self.app.update()
start.assert_not_called()
self.assertEqual(self.app.current_step.id, "correction")
self.assertEqual(self.app.variant_var.get(), "integrate")
self.assertEqual(self.app.state_store.step("correction")["variant"], "integrate")
self.assertIn("--deal-with-batched", self.app._make_command())
def test_integration_preserves_batch_statuses_but_invalidates_downstream_steps(self):
for variant in ("integrate", "batch"):
with self.subTest(variant=variant):
self.app.active_step_id = None
self.app.current_step = None
self.app.state_store.update_step("correction", variant=variant, batch_started=True)
statuses = {"submit_batches": "success", "batch_status": "detected",
"fetch_batches": "success", "annotation": "success"}
for step_id, status in statuses.items():
self.app.state_store.update_step(step_id, status=status)
self.app._populate_tree()
self.app.tree.selection_set("correction")
self.app.update()
with patch.object(self.app.runner, "start"), \
patch.object(self.app, "_missing_requirements", return_value=[]):
self.app._run_current_step()
self.assertEqual(self.app.active_step_id, "correction")
for step_id, status in statuses.items():
expected = status if variant == "integrate" and step_id != "annotation" else "stale"
self.assertEqual(self.app.state_store.step(step_id)["status"], expected)
self.app.active_step_id = None
def test_unsuccessful_batch_retrieval_stays_on_retrieval(self):
self.app.state_store.update_step("correction", variant="batch", last_run_variant="batch")
self.app._populate_tree()
self.app.tree.selection_set("fetch_batches")
self.app.update()
for code, interrupted in ((4, False), (1, False), (0, True)):
with self.subTest(code=code, interrupted=interrupted):
self.app.active_step_id = "fetch_batches"
self.app._finish_process(code, interrupted)
self.app.update()
self.assertEqual(self.app.current_step.id, "fetch_batches")
self.assertEqual(self.app.state_store.step("correction")["variant"], "batch")
def test_batch_watch_buttons_use_loaded_evaluation_and_stop_on_reload(self):
self.app.state_store.update_step("correction", variant="batch", last_run_variant="batch")
self.app._populate_tree()
@@ -222,19 +272,24 @@ class GuiConvenienceTests(unittest.TestCase):
self.app._move_selection_from("correction", 1)
select.assert_called_once_with("manual_resolution")
def test_labels_and_correction_notify_once_on_success(self):
for step_id in ("labels", "correction"):
def test_long_running_steps_notify_once_on_success(self):
expected_text = {
"labels": "labels",
"correction": "correction",
"annotation": "copies annotées",
"read_annotations": "annotations manuscrites",
}
for step_id, completion_text in expected_text.items():
with self.subTest(step=step_id), patch("copienator_gui.app.notify_desktop") as notify:
self.app.active_step_id = step_id
self.app._finish_process(0, False)
self.app._finish_process(0, False)
notify.assert_called_once()
self.assertIn(self.evaluation.name, notify.call_args.args[1])
self.assertIn("labels" if step_id == "labels" else "correction",
notify.call_args.args[1])
self.assertIn(completion_text, notify.call_args.args[1])
def test_incomplete_failed_and_interrupted_steps_notify_the_outcome_once(self):
for step_id in ("labels", "correction"):
for step_id in ("labels", "correction", "annotation", "read_annotations"):
for code, interrupted, outcome in (
(4, False, "partielle"), (1, False, "échouée"),
(0, True, "interrompue"), (130, False, "interrompue"),