miscs
This commit is contained in:
1 parent
c30aac0572
commit
834ffe32f2
7 files changed
+116
-14
No files matched your search
@@ -372,6 +372,50 @@ 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_batch_integration_success_selects_conflicts_or_cleanup(self):
|
||||
for conflicts, visited in product((None, "### Aucun conflit\n", "Copie01 A -> B\n"), (False, True)):
|
||||
with self.subTest(conflicts=conflicts, visited=visited):
|
||||
manual = self.evaluation / "manual_resolutions.txt"
|
||||
if conflicts is None:
|
||||
manual.unlink(missing_ok=True)
|
||||
else:
|
||||
manual.write_text(conflicts, encoding="utf-8")
|
||||
(self.evaluation / "correction.json").write_text("{}", encoding="utf-8")
|
||||
self.app.state_store.update_step(
|
||||
"correction", variant="integrate", last_run_variant="integrate"
|
||||
)
|
||||
self.app.state_store.update_step("manual_resolution", visited=visited, status="stale")
|
||||
self.app._populate_tree()
|
||||
self.app.tree.selection_set("correction")
|
||||
self.app.update()
|
||||
self.app.active_step_id = "correction"
|
||||
with patch.object(self.app.runner, "start") as start:
|
||||
self.app._finish_process(0, False)
|
||||
self.app.update()
|
||||
start.assert_not_called()
|
||||
expected = "manual_resolution" if conflicts == "Copie01 A -> B\n" else "post_correction"
|
||||
self.assertEqual(self.app.current_step.id, expected)
|
||||
expected_status = "stale" if expected == "manual_resolution" else "success"
|
||||
self.assertEqual(self.app.state_store.step("manual_resolution")["status"], expected_status)
|
||||
if expected_status == "success":
|
||||
self.assertEqual(self.app.tree.item("manual_resolution", "values"), ("Réussie",))
|
||||
for step_id in ("submit_batches", "batch_status", "fetch_batches", "prepare_recorrection"):
|
||||
self.assertFalse(self.app.state_store.step(step_id).get("visited"))
|
||||
|
||||
def test_unsuccessful_batch_integration_stays_on_correction(self):
|
||||
self.app.state_store.update_step(
|
||||
"correction", variant="integrate", last_run_variant="integrate"
|
||||
)
|
||||
self.app._populate_tree()
|
||||
self.app.tree.selection_set("correction")
|
||||
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 = "correction"
|
||||
self.app._finish_process(code, interrupted)
|
||||
self.app.update()
|
||||
self.assertEqual(self.app.current_step.id, "correction")
|
||||
|
||||
def test_correction_invalidates_batches_only_when_regenerating_or_resetting(self):
|
||||
for variant, action in product(
|
||||
("integrate", "live", "refaire", "batch", "hybrid", "reset"), ("run", "mark")
|
||||
|
||||
Reference in new issue
Block a user