diff --git a/app/views/refcomp.py b/app/views/refcomp.py index 9be3c975..6ac88ad2 100644 --- a/app/views/refcomp.py +++ b/app/views/refcomp.py @@ -232,8 +232,8 @@ def refcomp_load(formation_id=None): filename = refs_distrib_dict[int(form.referentiel_standard.data)][ "filename" ] - except (ValueError, IndexError): - raise ScoValueError("choix invalide") + except (ValueError, IndexError) as exc: + raise ScoValueError("choix invalide") from exc f = open(filename, encoding="utf-8") else: raise ScoValueError("choix invalide") @@ -246,8 +246,7 @@ def refcomp_load(formation_id=None): raise ScoFormatError( f"fichier XML Orébut invalide (1): {exc.args}" ) from exc - except ScoFormatError: - raise + # peut aussi lever ScoFormatError flash( Markup(f"Référentiel {Path(filename).name} chargé."), diff --git a/tests/ressources/formations/scodoc_formation_BUT_GB_v1.xml b/tests/ressources/formations/scodoc_formation_BUT_GB_v1.xml new file mode 100644 index 00000000..e51e1166 --- /dev/null +++ b/tests/ressources/formations/scodoc_formation_BUT_GB_v1.xml @@ -0,0 +1,758 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/unit/test_caches.py b/tests/unit/test_caches.py index 1644dc7a..14b9a0c0 100644 --- a/tests/unit/test_caches.py +++ b/tests/unit/test_caches.py @@ -9,7 +9,7 @@ Usage: pytest tests/unit/test_caches.py """ -from flask import current_app, g +from flask import g import app from app import db