Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
panacota
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Amandine PERRIN
panacota
Commits
318321a2
Commit
318321a2
authored
3 years ago
by
Amandine PERRIN
Browse files
Options
Downloads
Patches
Plain Diff
get report of unit tests coverage
parent
d78b8866
No related branches found
No related tags found
No related merge requests found
Pipeline
#62549
failed
3 years ago
Stage: test
Stage: coverage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+2
-0
2 additions, 0 deletions
.gitlab-ci.yml
PanACoTA/utils_argparse.py
+5
-2
5 additions, 2 deletions
PanACoTA/utils_argparse.py
test/test_unit/test_utils-argparse.py
+16
-0
16 additions, 0 deletions
test/test_unit/test_utils-argparse.py
with
23 additions
and
2 deletions
.gitlab-ci.yml
+
2
−
0
View file @
318321a2
...
@@ -143,6 +143,8 @@ coverage:
...
@@ -143,6 +143,8 @@ coverage:
-
pip3 install -r requirements-dev.txt
-
pip3 install -r requirements-dev.txt
script
:
script
:
-
pwd
-
pwd
-
mv .coverage.unit .coverage
-
coverage report
-
coverage combine .coverage.unit .coverage.functional
-
coverage combine .coverage.unit .coverage.functional
-
coverage report -i
-
coverage report -i
-
coverage html -i
-
coverage html -i
...
...
This diff is collapsed.
Click to expand it.
PanACoTA/utils_argparse.py
+
5
−
2
View file @
318321a2
...
@@ -200,6 +200,8 @@ class Conf_all_parser(configparser.ConfigParser):
...
@@ -200,6 +200,8 @@ class Conf_all_parser(configparser.ConfigParser):
path to configuration file
path to configuration file
readsec : list
readsec : list
list of sections of the config file to read
list of sections of the config file to read
clean_str : boolean
by default, remove
"
surrounding strings. If no need to do it, set this parameter to False
Attributes
Attributes
----------
----------
...
@@ -209,7 +211,7 @@ class Conf_all_parser(configparser.ConfigParser):
...
@@ -209,7 +211,7 @@ class Conf_all_parser(configparser.ConfigParser):
{section1: {param: value}, {section2: {param:value}}}
{section1: {param: value}, {section2: {param:value}}}
"""
"""
def
__init__
(
self
,
conffile
,
readsec
=
[]):
def
__init__
(
self
,
conffile
,
readsec
=
[]
,
clean_str
=
True
):
super
().
__init__
()
super
().
__init__
()
# If there is a config file specified, but it does not exist -> exit with error message
# If there is a config file specified, but it does not exist -> exit with error message
if
conffile
!=
""
and
not
os
.
path
.
isfile
(
conffile
):
if
conffile
!=
""
and
not
os
.
path
.
isfile
(
conffile
):
...
@@ -229,7 +231,8 @@ class Conf_all_parser(configparser.ConfigParser):
...
@@ -229,7 +231,8 @@ class Conf_all_parser(configparser.ConfigParser):
# If not, create empty section, and associate with empty dict
# If not, create empty section, and associate with empty dict
if
sec
in
dict
(
self
):
if
sec
in
dict
(
self
):
self
.
sec_dicts
[
sec
]
=
dict
(
self
[
sec
])
self
.
sec_dicts
[
sec
]
=
dict
(
self
[
sec
])
self
.
clean_strings
(
sec
)
if
clean_str
:
self
.
clean_strings
(
sec
)
else
:
else
:
self
.
sec_dicts
[
sec
]
=
{}
self
.
sec_dicts
[
sec
]
=
{}
self
.
add_section
(
sec
)
self
.
add_section
(
sec
)
...
...
This diff is collapsed.
Click to expand it.
test/test_unit/test_utils-argparse.py
+
16
−
0
View file @
318321a2
...
@@ -271,6 +271,22 @@ def test_conf_parser_init():
...
@@ -271,6 +271,22 @@ def test_conf_parser_init():
"
sec4
"
:
{}}
# But sec4 dict is empty (no param given in configfile)
"
sec4
"
:
{}}
# But sec4 dict is empty (no param given in configfile)
def
test_conf_parser_clean_str
(
capsys
):
"""
Check that surounding
""
are removed
"""
cfg_file
=
os
.
path
.
join
(
"
test
"
,
"
data
"
,
"
utils
"
,
"
configfile-str.ini
"
)
c
=
autils
.
Conf_all_parser
(
cfg_file
,
[
"
sec2
"
,
"
sec_bool
"
])
assert
c
.
get_section_dict
(
"
sec2
"
)
==
{
"
param2
"
:
""
,
"
myval
"
:
"
parameter
"
,
'
param3
'
:
"
myparameter
"
,
"
param1
"
:
"
3
"
}
assert
c
.
get_section_dict
(
"
sec_bool
"
)
==
{
"
bool num_false
"
:
"
0
"
,
"
bool_num_true
"
:
"
1
"
,
"
bool_f
"
:
"
off
"
,
"
bool_t
"
:
"
ON
"
,
"
bool_n
"
:
"
no
"
,
"
bool_y
"
:
"
YES
"
,
"
bool_false
"
:
"
FalSe
"
,
"
bool_true
"
:
"
tRUE
"
,
"
param1
"
:
"
3
"
,
"
param2
"
:
"
10
"
}
def
test_conf_parser_get_section
(
capsys
):
def
test_conf_parser_get_section
(
capsys
):
"""
"""
Test get dict of values for a given section
Test get dict of values for a given section
...
...
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