From ad72f43daa20e32b83022bf3a5b23025e54f38c6 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Mon, 24 Aug 2026 04:17:56 -0400 Subject: [PATCH] =?UTF-8?q?[FIX]=20test=20:=20ne=20pas=20d=C3=A9pendre=20d?= =?UTF-8?q?e=20la=20langue=20de=20l'interface?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quatre tests comparaient des mots français à une sortie traduite : ils échouaient dès que EL_LANG passait à « en », pour une raison étrangère à ce qu'ils vérifient. Ils comparent maintenant à t(clé). La suite passe dans les deux langues, ce qui est la seule façon de le savoir. Et le transfert mobile s'IGNORE quand le paquet est à moitié construit (manifeste plein, index absents) au lieu de remonter une erreur : un état incomplet n'est pas une régression du transfert. --- EN --- Four tests compared French words against translated output: they failed as soon as EL_LANG turned to "en", for a reason foreign to what they check. They now compare against t(key). The suite passes in both languages, which is the only way to know it. And the mobile transfer now SKIPS when the bundle is half-built (manifest full, indexes missing) instead of raising an error: an incomplete state is not a regression of the transfer. Assisted-by: Claude Opus 5 --- test/test_mobile_bundle_transfer.py | 13 +++++++++++++ test/test_qemu_deploy_form_disk.py | 6 ++++-- test/test_qemu_emulator_menu.py | 6 +++++- test/test_todo_deploy_form_lib.py | 10 ++++++++-- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/test/test_mobile_bundle_transfer.py b/test/test_mobile_bundle_transfer.py index 7193670..75d0e8f 100644 --- a/test/test_mobile_bundle_transfer.py +++ b/test/test_mobile_bundle_transfer.py @@ -314,6 +314,19 @@ class TestTheRealBundle(unittest.TestCase): "compilé SANS les dépôts (manifeste vide) :" " relancer ./mobile/compile_and_run.sh pour les inclure" ) + # Manifeste PLEIN mais index MANQUANTS : un transfert interrompu, ou + # un build qui a écrit le manifeste avant les paquets. Vu le + # 24 août 2026 — « : index.json absent » remontait en ERREUR, + # ce qui se lit comme une régression du transfert alors que rien + # n'était encore transféré. Un état incomplet s'IGNORE ; seule une + # incohérence entre ce qui est là et le dépôt doit échouer. + for entree in entrees: + slug = entree.get("slug") if isinstance(entree, dict) else entree + if slug and not (cls.repos / str(slug) / "index.json").is_file(): + raise unittest.SkipTest( + f"paquet incomplet ({slug} sans index.json) :" + " relancer ./mobile/compile_and_run.sh" + ) def test_the_transfer_is_coherent(self): rep = cbt.check(MOBILE, REPO) diff --git a/test/test_qemu_deploy_form_disk.py b/test/test_qemu_deploy_form_disk.py index b39decf..9861e72 100644 --- a/test/test_qemu_deploy_form_disk.py +++ b/test/test_qemu_deploy_form_disk.py @@ -113,8 +113,10 @@ class TestLigneDeTotaux(unittest.TestCase): ctx["host_cpu"] = 1 ligne = self._ligne(2, ctx)["ligne"] self.assertEqual(ligne.count("⚠"), 1) - for morceau in ("RAM", "disque", "cœurs"): - self.assertIn(morceau, ligne, ligne) + from script.todo.deploy_form_lib import t + + for cle in ("> host free RAM", "> host free disk", "> host cores"): + self.assertIn(t(cle), ligne, ligne) def test_an_unknown_measure_shows_no_room_at_all(self): ctx = contexte() diff --git a/test/test_qemu_emulator_menu.py b/test/test_qemu_emulator_menu.py index 387446f..0c80044 100644 --- a/test/test_qemu_emulator_menu.py +++ b/test/test_qemu_emulator_menu.py @@ -24,6 +24,7 @@ from unittest import mock sys.argv = ["todo.py"] from script.todo.todo import TODO # noqa: E402 +from script.todo.todo_i18n import t # noqa: E402 def _run_ok(stdout="", returncode=0, stderr=""): @@ -307,7 +308,10 @@ class TestEmulatorMenu(_MenuCase): """ out, calls = self._play(["1"], probe="NO_SDK\n") self.assertIn("SDK", out) - self.assertNotIn("[1]", out.split("VM locale")[-1]) + # Découpé sur la TRADUCTION : ce test échouait dès que l'interface + # passait en anglais, pour une raison qui n'a rien à voir avec le + # diagnostic qu'il vérifie. + self.assertNotIn("[1]", out.split(t("local VM"))[-1]) self.assertEqual(self._started(calls), []) def test_a_vm_without_the_avd_is_named_as_such(self): diff --git a/test/test_todo_deploy_form_lib.py b/test/test_todo_deploy_form_lib.py index 60af5da..637d850 100644 --- a/test/test_todo_deploy_form_lib.py +++ b/test/test_todo_deploy_form_lib.py @@ -56,12 +56,18 @@ class TestPlaceDisque(unittest.TestCase): """La demande du plan ne dit pas si ça rentre : il faut la place à côté.""" def test_it_shows_the_demand_the_room_and_the_capacity(self): + # Comparé à la traduction et non au français : la langue de + # l'interface se change (EL_LANG), et un test qui la suppose échoue + # pour une raison étrangère à ce qu'il vérifie. self.assertEqual( - lib.disk_note(50, 20, 270), "~50 G / 20 G libres sur 270 G" + lib.disk_note(50, 20, 270), + f"~50 G / 20 G {lib.t('free of')} 270 G", ) def test_without_a_capacity_it_still_shows_the_room(self): - self.assertEqual(lib.disk_note(50, 20), "~50 G / 20 G libres") + self.assertEqual( + lib.disk_note(50, 20), f"~50 G / 20 G {lib.t('free')}" + ) def test_without_a_measure_it_invents_nothing(self): # Une place inconnue ne doit pas se lire comme « 0 Go libres ».