G3-A câblage moteur réel (engine_bridge.py) : EngineSettings + NerManagers à chargement paresseux (aucun manager à l'import), kwargs alignés CLI/V5 (make_vector_redaction=False, also_make_raster_burn=True, config_path, use_hf, ner/gliner/camembert_manager, ogc_label) ; make_process_fn engine injectable ; état managers not_loaded/loading/ready/unavailable, échecs optionnels tolérés. G3-B Configuration (config_state.py + tabs/tab_config.py) : ConfigState → EngineSettings, profils via profile_defaults (path injectable), options raster/NER local/profil/sortie, état managers, sections admin-only via admin_mode. G3-C Licence UI (machine_id.py + tab_about) : activation par clef (LicenseClient.activate), bouton vérifier (check), affichage statut, aucun token loggé, aucun appel réseau au démarrage (local_status seul). Intégration : tab_usage exécute via le moteur réel selon ConfigState (make_process_fn), anti double-lancement UI. app.py câble Config↔Usage↔licence. G3-D build-prep : anonymisation_gui_v6_onefile.spec (entry V6, customtkinter + modules gui_v6 en hiddenimports). Installateur Anonymisation.iss produit déjà la cible Anonymisation-Setup.exe. Aucun artefact .exe commité ; build Windows à part. Tests +14 (engine_bridge 8, config_state 6). self-test exit 0, 46 tests gui_v6, 193 tests/unit (0 régression). Moteur/V5/specs CLI intacts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
57 lines
1.7 KiB
Python
57 lines
1.7 KiB
Python
"""Tests de l'état de configuration G3-B (profils/options résolus sans fichiers réels)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from gui_v6.config_state import ConfigState, default_profile_key, list_profile_keys
|
|
from gui_v6.engine_bridge import EngineSettings
|
|
|
|
|
|
def test_to_engine_settings_defaults():
|
|
settings = ConfigState().to_engine_settings(config_path=Path("/tmp/c.yml"))
|
|
assert isinstance(settings, EngineSettings)
|
|
assert settings.make_vector_redaction is False
|
|
assert settings.also_make_raster_burn is True
|
|
assert settings.use_local_ner is True
|
|
assert settings.config_path == Path("/tmp/c.yml")
|
|
|
|
|
|
def test_to_engine_settings_custom():
|
|
state = ConfigState(
|
|
profile="oncologie",
|
|
raster_burn=False,
|
|
use_local_ner=False,
|
|
enable_gliner=True,
|
|
ogc_label="OCG",
|
|
)
|
|
settings = state.to_engine_settings()
|
|
assert settings.also_make_raster_burn is False
|
|
assert settings.use_local_ner is False
|
|
assert settings.enable_gliner is True
|
|
assert settings.profile == "oncologie"
|
|
assert settings.ogc_label == "OCG"
|
|
|
|
|
|
def test_list_profile_keys_injected():
|
|
keys = list_profile_keys(lister=lambda: {"b": {}, "a": {}})
|
|
assert keys == ["a", "b"]
|
|
|
|
|
|
def test_list_profile_keys_failure_returns_empty():
|
|
def boom():
|
|
raise RuntimeError("pas de profils")
|
|
|
|
assert list_profile_keys(lister=boom) == []
|
|
|
|
|
|
def test_default_profile_key_injected():
|
|
assert default_profile_key(getter=lambda: "defaut") == "defaut"
|
|
|
|
|
|
def test_default_profile_key_failure_returns_none():
|
|
def boom():
|
|
raise RuntimeError("ko")
|
|
|
|
assert default_profile_key(getter=boom) is None
|