Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCODOC_R6A06
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Milleville
SCODOC_R6A06
Commits
12e14dc6
Commit
12e14dc6
authored
1 year ago
by
Emmanuel Viennet
Browse files
Options
Downloads
Patches
Plain Diff
Fix unit tests
parent
66b8542d
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
tests/unit/sco_fake_gen.py
+2
-3
2 additions, 3 deletions
tests/unit/sco_fake_gen.py
tests/unit/setup.py
+1
-2
1 addition, 2 deletions
tests/unit/setup.py
tests/unit/yaml_setup.py
+8
-1
8 additions, 1 deletion
tests/unit/yaml_setup.py
tests/unit/yaml_setup_but.py
+1
-1
1 addition, 1 deletion
tests/unit/yaml_setup_but.py
with
12 additions
and
7 deletions
tests/unit/sco_fake_gen.py
+
2
−
3
View file @
12e14dc6
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
tests/unit/setup.py
+
1
−
2
View file @
12e14dc6
...
@@ -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
,
...
...
This diff is collapsed.
Click to expand it.
tests/unit/yaml_setup.py
+
8
−
1
View file @
12e14dc6
...
@@ -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
"
,
{}))
...
...
This diff is collapsed.
Click to expand it.
tests/unit/yaml_setup_but.py
+
1
−
1
View file @
12e14dc6
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment