From 6df0e8c941b6cedd30849e473acec744c1d30113 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 29 Nov 2022 00:07:34 +0100 Subject: [PATCH] =?UTF-8?q?Pr=C3=A9pare=20tests=20unitaires=20jury=20BUT?= =?UTF-8?q?=20avec=20parcours?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/refcomp.py | 7 +- .../formations/scodoc_formation_BUT_GB_v1.xml | 758 ++++++++++++++++++ tests/unit/test_caches.py | 2 +- 3 files changed, 762 insertions(+), 5 deletions(-) create mode 100644 tests/ressources/formations/scodoc_formation_BUT_GB_v1.xml 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