Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amandine PERRIN
pipeline_annotation
Commits
318321a2
Commit
318321a2
authored
Aug 02, 2021
by
Amandine PERRIN
Browse files
get report of unit tests coverage
parent
d78b8866
Pipeline
#62549
failed with stages
in 49 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
318321a2
...
...
@@ -143,6 +143,8 @@ coverage:
-
pip3 install -r requirements-dev.txt
script
:
-
pwd
-
mv .coverage.unit .coverage
-
coverage report
-
coverage combine .coverage.unit .coverage.functional
-
coverage report -i
-
coverage html -i
...
...
PanACoTA/utils_argparse.py
View file @
318321a2
...
...
@@ -200,6 +200,8 @@ class Conf_all_parser(configparser.ConfigParser):
path to configuration file
readsec : list
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
----------
...
...
@@ -209,7 +211,7 @@ class Conf_all_parser(configparser.ConfigParser):
{section1: {param: value}, {section2: {param:value}}}
"""
def
__init__
(
self
,
conffile
,
readsec
=
[]):
def
__init__
(
self
,
conffile
,
readsec
=
[]
,
clean_str
=
True
):
super
().
__init__
()
# If there is a config file specified, but it does not exist -> exit with error message
if
conffile
!=
""
and
not
os
.
path
.
isfile
(
conffile
):
...
...
@@ -229,7 +231,8 @@ class Conf_all_parser(configparser.ConfigParser):
# If not, create empty section, and associate with empty dict
if
sec
in
dict
(
self
):
self
.
sec_dicts
[
sec
]
=
dict
(
self
[
sec
])
self
.
clean_strings
(
sec
)
if
clean_str
:
self
.
clean_strings
(
sec
)
else
:
self
.
sec_dicts
[
sec
]
=
{}
self
.
add_section
(
sec
)
...
...
test/test_unit/test_utils-argparse.py
View file @
318321a2
...
...
@@ -271,6 +271,22 @@ def test_conf_parser_init():
"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
):
"""
Test get dict of values for a given section
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment