Don't mark batched steps «À revalider».
This commit is contained in:
1 parent
c155e3eebc
commit
52a8589261
2 files changed
+45
-14
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
import tempfile
|
||||
import unittest
|
||||
from itertools import product
|
||||
from pathlib import Path
|
||||
from tkinter import ttk
|
||||
from unittest.mock import patch
|
||||
@@ -280,9 +281,11 @@ class GuiConvenienceTests(unittest.TestCase):
|
||||
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):
|
||||
def test_correction_invalidates_batches_only_when_regenerating_or_resetting(self):
|
||||
for variant, action in product(
|
||||
("integrate", "live", "refaire", "batch", "hybrid", "reset"), ("run", "mark")
|
||||
):
|
||||
with self.subTest(variant=variant, action=action):
|
||||
self.app.active_step_id = None
|
||||
self.app.current_step = None
|
||||
self.app.state_store.update_step("correction", variant=variant, batch_started=True)
|
||||
@@ -294,14 +297,36 @@ class GuiConvenienceTests(unittest.TestCase):
|
||||
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")
|
||||
patch.object(self.app, "_missing_requirements", return_value=[]), \
|
||||
patch("copienator_gui.app.messagebox.askyesno", return_value=True):
|
||||
if action == "run":
|
||||
self.app._run_current_step()
|
||||
self.assertEqual(self.app.active_step_id, "correction")
|
||||
else:
|
||||
self.app._mark_step("success")
|
||||
for step_id, status in statuses.items():
|
||||
expected = status if variant == "integrate" and step_id != "annotation" else "stale"
|
||||
preserve = variant in {"integrate", "live", "refaire"} and step_id != "annotation"
|
||||
expected = status if preserve else "stale"
|
||||
self.assertEqual(self.app.state_store.step(step_id)["status"], expected)
|
||||
self.app.active_step_id = None
|
||||
|
||||
def test_checking_batch_status_preserves_downstream_statuses(self):
|
||||
self.app.state_store.update_step("correction", batch_started=True)
|
||||
statuses = {"fetch_batches": "success", "annotation": "detected"}
|
||||
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("batch_status")
|
||||
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, "batch_status")
|
||||
self.app.active_step_id = None
|
||||
self.app._mark_step("success")
|
||||
for step_id, status in statuses.items():
|
||||
self.assertEqual(self.app.state_store.step(step_id)["status"], status)
|
||||
|
||||
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()
|
||||
|
||||
Reference in new issue
Block a user