fix(gui): flag legacy ONNX + log fichier dès l'entrée frozen (P0-5/E1)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,11 @@ Le mode ``--self-test`` vérifie que tout le socle GUI V6 s'importe correctement
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Frozen Windows : désactiver le manager ONNX legacy AVANT tout import du cœur,
|
||||
# pour éviter « cannot load module more than once per process » (hotfix CLI 6c6f653).
|
||||
os.environ.setdefault("ANON_SKIP_LEGACY_ONNX_MANAGER", "1")
|
||||
|
||||
|
||||
def _self_test() -> int:
|
||||
@@ -52,6 +57,10 @@ def main(argv=None) -> int:
|
||||
if "--self-test" in argv:
|
||||
return _self_test()
|
||||
|
||||
from gui_v6.logging_setup import setup_file_logging
|
||||
|
||||
setup_file_logging()
|
||||
|
||||
from gui_v6.app import AnonymisationApp
|
||||
|
||||
application = AnonymisationApp()
|
||||
|
||||
16
tests/unit/test_gui_v6_entry_frozen_flag.py
Normal file
16
tests/unit/test_gui_v6_entry_frozen_flag.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import os
|
||||
import importlib
|
||||
|
||||
|
||||
def test_entry_sets_legacy_onnx_flag_on_import(monkeypatch):
|
||||
monkeypatch.delenv("ANON_SKIP_LEGACY_ONNX_MANAGER", raising=False)
|
||||
import Pseudonymisation_Gui_V6 as entry
|
||||
importlib.reload(entry)
|
||||
assert os.environ.get("ANON_SKIP_LEGACY_ONNX_MANAGER") == "1"
|
||||
|
||||
|
||||
def test_entry_does_not_override_explicit_flag(monkeypatch):
|
||||
monkeypatch.setenv("ANON_SKIP_LEGACY_ONNX_MANAGER", "0")
|
||||
import Pseudonymisation_Gui_V6 as entry
|
||||
importlib.reload(entry)
|
||||
assert os.environ.get("ANON_SKIP_LEGACY_ONNX_MANAGER") == "0"
|
||||
Reference in New Issue
Block a user