Skip to content
Snippets Groups Projects
Commit 12e14dc6 authored by Emmanuel Viennet's avatar Emmanuel Viennet
Browse files

Fix unit tests

parent 66b8542d
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,6 @@ from app.models import ( ...@@ -25,7 +25,6 @@ from app.models import (
Matiere, Matiere,
ModuleImpl, ModuleImpl,
) )
from app.scodoc import notesdb as ndb
from app.scodoc import codes_cursus from app.scodoc import codes_cursus
from app.scodoc import sco_edit_matiere from app.scodoc import sco_edit_matiere
from app.scodoc import sco_edit_module from app.scodoc import sco_edit_module
...@@ -41,8 +40,6 @@ from app.scodoc.sco_exceptions import ScoValueError ...@@ -41,8 +40,6 @@ from app.scodoc.sco_exceptions import ScoValueError
from config import Config, TestConfig from config import Config, TestConfig
from tests.unit.setup import NOTES_T
random.seed(12345) # tests reproductibles random.seed(12345) # tests reproductibles
...@@ -433,6 +430,8 @@ class ScoFake(object): ...@@ -433,6 +430,8 @@ class ScoFake(object):
notes: liste des notes (float). notes: liste des notes (float).
Si non spécifié, utilise la liste NOTES_T Si non spécifié, utilise la liste NOTES_T
""" """
from tests.unit.setup import NOTES_T
if notes is None: if notes is None:
notes = NOTES_T notes = NOTES_T
for e in eval_list: for e in eval_list:
......
...@@ -7,14 +7,13 @@ from app import db, models ...@@ -7,14 +7,13 @@ from app import db, models
from app.models import Formation from app.models import Formation
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc import codes_cursus from app.scodoc import codes_cursus
from tests.unit import sco_fake_gen
# Valeurs des notes saisies par les tests: # Valeurs des notes saisies par les tests:
NOTES_T = [ NOTES_T = [
float(x) for x in (20, 0, 10, 13 / 7.0, 12.5, 24.0 / 11) + tuple(range(1, 19)) float(x) for x in (20, 0, 10, 13 / 7.0, 12.5, 24.0 / 11) + tuple(range(1, 19))
] ]
from tests.unit import sco_fake_gen
def build_formation_test( def build_formation_test(
nb_mods=1, nb_mods=1,
......
...@@ -127,7 +127,7 @@ def create_formsemestre( ...@@ -127,7 +127,7 @@ def create_formsemestre(
modules = [ modules = [
m m
for m in formsemestre.formation.modules.filter_by(semestre_id=semestre_id) for m in formsemestre.formation.modules.filter_by(semestre_id=semestre_id)
if (not m.parcours) # module de tronc commun if not m.parcours # module de tronc commun
or (not sem_parcours_ids) # semestre sans parcours => tous or (not sem_parcours_ids) # semestre sans parcours => tous
or ({p.id for p in m.parcours} & sem_parcours_ids) or ({p.id for p in m.parcours} & sem_parcours_ids)
] ]
...@@ -329,6 +329,13 @@ def setup_from_yaml(filename: str) -> tuple[dict, Formation, list[str]]: ...@@ -329,6 +329,13 @@ def setup_from_yaml(filename: str) -> tuple[dict, Formation, list[str]]:
with open(filename, encoding="utf-8") as f: with open(filename, encoding="utf-8") as f:
doc = yaml.safe_load(f.read()) doc = yaml.safe_load(f.read())
# Passe tous les noms en majuscules (car stockés ainsi en base)
if "Etudiants" in doc:
doc["Etudiants"] = {k.upper(): v for (k, v) in doc["Etudiants"].items()}
for e in doc["Etudiants"].values():
if "prenom" in e:
e["prenom"] = e["prenom"].upper()
# Charge de ref. comp. avant la formation, de façon à pouvoir # Charge de ref. comp. avant la formation, de façon à pouvoir
# re-créer les associations UE/Niveaux # re-créer les associations UE/Niveaux
yaml_setup_but.setup_formation_referentiel(doc.get("ReferentielCompetences", {})) yaml_setup_but.setup_formation_referentiel(doc.get("ReferentielCompetences", {}))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment