feat(gui): n'afficher comme disponibles que les moteurs embarqués dans le build GUI
Axe application GUI (utilisateur final) : cohérence UI/moteurs propre au build GUI, sans présumer du build CLI. EDS-Pseudo / GLiNER désactivés (switch disabled + « non embarqué dans cette version ») et `enable_eds/gliner` forcés à False quand indisponibles ; CamemBERT-bio reste le moteur standard actif. Note Moteurs des Profils rendue honnête. `_mini_toggle` gère `disabled`/`disabled_hint` + `.switch`. 2 tests GUI (toggles désactivés si indispo + état forcé False ; actifs si dispo). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -295,3 +295,48 @@ def test_regles_moved_into_profils(ctk_root, tmp_path, monkeypatch):
|
||||
# le builder du sous-onglet séparé n'existe plus
|
||||
assert "rul" not in tab._panels
|
||||
tab.destroy()
|
||||
|
||||
|
||||
def test_unavailable_engines_disabled_in_reglages(ctk_root, tmp_path, monkeypatch):
|
||||
"""Honnêteté moteurs : EDS-Pseudo / GLiNER non embarqués → switch désactivé
|
||||
et état forcé à False ; CamemBERT-bio reste actif."""
|
||||
import engine_capabilities as ec
|
||||
from gui_v6.tabs import tab_config
|
||||
|
||||
monkeypatch.setattr(tab_config, "_app_base_dir", lambda: tmp_path)
|
||||
fake = {
|
||||
"camembert": ec.EngineCapability("camembert", "CamemBERT-bio (standard)", True, True, "ok"),
|
||||
"eds": ec.EngineCapability("eds", "EDS-Pseudo (optionnel)", False, False, "non embarqué dans cette version (manque : edsnlp, spacy)"),
|
||||
"gliner": ec.EngineCapability("gliner", "GLiNER (optionnel)", False, False, "non embarqué dans cette version (manque : gliner)"),
|
||||
}
|
||||
monkeypatch.setattr(tab_config.engine_capabilities, "capabilities_map", lambda probes=None: fake)
|
||||
|
||||
tab = tab_config.ConfigTab(ctk_root)
|
||||
tab.update_idletasks()
|
||||
|
||||
assert str(tab._tog_ner.switch.cget("state")) == "normal" # CamemBERT standard actif
|
||||
assert str(tab._tog_eds.switch.cget("state")) == "disabled"
|
||||
assert str(tab._tog_gli.switch.cget("state")) == "disabled"
|
||||
assert tab._state.enable_eds is False
|
||||
assert tab._state.enable_gliner is False
|
||||
tab.destroy()
|
||||
|
||||
|
||||
def test_available_engines_enabled_in_reglages(ctk_root, tmp_path, monkeypatch):
|
||||
"""Si les moteurs optionnels sont embarqués, leurs switches restent actifs."""
|
||||
import engine_capabilities as ec
|
||||
from gui_v6.tabs import tab_config
|
||||
|
||||
monkeypatch.setattr(tab_config, "_app_base_dir", lambda: tmp_path)
|
||||
fake = {
|
||||
"camembert": ec.EngineCapability("camembert", "CamemBERT-bio (standard)", True, True, "ok"),
|
||||
"eds": ec.EngineCapability("eds", "EDS-Pseudo (optionnel)", True, False, "edsnlp + spacy disponibles"),
|
||||
"gliner": ec.EngineCapability("gliner", "GLiNER (optionnel)", True, False, "gliner disponible"),
|
||||
}
|
||||
monkeypatch.setattr(tab_config.engine_capabilities, "capabilities_map", lambda probes=None: fake)
|
||||
|
||||
tab = tab_config.ConfigTab(ctk_root)
|
||||
tab.update_idletasks()
|
||||
assert str(tab._tog_eds.switch.cget("state")) == "normal"
|
||||
assert str(tab._tog_gli.switch.cget("state")) == "normal"
|
||||
tab.destroy()
|
||||
|
||||
Reference in New Issue
Block a user