Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
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
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
esde
machine-learning
MLAir
Commits
77e61dc6
Commit
77e61dc6
authored
5 years ago
by
lukas leufen
Browse files
Options
Downloads
Patches
Plain Diff
merged pytest cov html and term call
parent
55da63d7
Branches
Branches containing commit
Tags
Tags containing commit
3 merge requests
!90
WIP: new release update
,
!89
Resolve "release branch / CI on gpu"
,
!85
Resolve "new gitlab runner specialised for mlt"
Pipeline
#33792
passed
5 years ago
Stage: test
Stage: pages
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CI/run_pytest.sh
+0
-3
0 additions, 3 deletions
CI/run_pytest.sh
CI/run_pytest_coverage.sh
+6
-7
6 additions, 7 deletions
CI/run_pytest_coverage.sh
src/helpers.py
+2
-3
2 additions, 3 deletions
src/helpers.py
with
8 additions
and
13 deletions
CI/run_pytest.sh
+
0
−
3
View file @
77e61dc6
...
@@ -39,13 +39,10 @@ TEST_PASSED="$(echo "${TEST_PASSED}" | (grep -oP '\d*'))"
...
@@ -39,13 +39,10 @@ TEST_PASSED="$(echo "${TEST_PASSED}" | (grep -oP '\d*'))"
if
[[
-z
"
$TEST_FAILED
"
]]
;
then
if
[[
-z
"
$TEST_FAILED
"
]]
;
then
TEST_FAILED
=
0
TEST_FAILED
=
0
fi
fi
#let "TEST_PASSED=${TEST_PASSED}-${TEST_FAILED}"
((
TEST_PASSED
=
TEST_PASSED-TEST_FAILED
))
((
TEST_PASSED
=
TEST_PASSED-TEST_FAILED
))
# calculate metrics
# calculate metrics
((
SUM
=
TEST_FAILED+TEST_PASSED
))
((
SUM
=
TEST_FAILED+TEST_PASSED
))
((
TEST_PASSED_RATIO
=
TEST_PASSED
*
100/SUM
))
((
TEST_PASSED_RATIO
=
TEST_PASSED
*
100/SUM
))
#let "SUM=${TEST_FAILED}+${TEST_PASSED}"
#let "TEST_PASSED_RATIO=${TEST_PASSED}*100/${SUM}"
# report
# report
if
[[
${
IS_FAILED
}
-eq
0
]]
;
then
if
[[
${
IS_FAILED
}
-eq
0
]]
;
then
...
...
This diff is collapsed.
Click to expand it.
CI/run_pytest_coverage.sh
+
6
−
7
View file @
77e61dc6
#!/usr/bin/env bash
#!/usr/bin/env bash
# run coverage twice, 1) for html deploy 2) for success evaluation
# run coverage twice, 1) for html deploy 2) for success evaluation
python3.6
-m
pytest
--cov
=
src
--cov-report
html
test
/
python3.6
-m
pytest
--cov
=
src
--cov-report
term
--cov-report
html
test
/ |
tee
coverage_results.out
python3.6
-m
pytest
--cov
=
src
--cov-report
term
test
/ |
tee
coverage_results.out
IS_FAILED
=
$?
IS_FAILED
=
$?
# move html coverage report
# move html coverage report
mkdir
coverage/
mkdir
coverage/
BRANCH_NAME
=
$(
echo
-e
"
${
CI_COMMIT_REF_NAME
////_
}
"
)
BRANCH_NAME
=
$(
echo
-e
"
${
CI_COMMIT_REF_NAME
////_
}
"
)
mkdir
coverage/
${
BRANCH_NAME
}
mkdir
"
coverage/
${
BRANCH_NAME
}
"
mkdir
coverage/recent
mkdir
"
coverage/recent
"
cp
-r
htmlcov/
*
coverage/
${
BRANCH_NAME
}
/.
cp
-r
htmlcov/
*
"
coverage/
${
BRANCH_NAME
}
/.
"
cp
-r
htmlcov/
*
coverage/recent/.
cp
-r
htmlcov/
*
coverage/recent/.
if
[[
"
${
CI_COMMIT_REF_NAME
}
"
=
"master"
]]
;
then
if
[[
"
${
CI_COMMIT_REF_NAME
}
"
=
"master"
]]
;
then
cp
-r
htmlcov/
*
coverage/.
cp
-r
htmlcov/
*
coverage/.
...
@@ -19,10 +18,10 @@ fi
...
@@ -19,10 +18,10 @@ fi
# extract coverage information
# extract coverage information
COVERAGE_RATIO
=
"
$(
grep
-oP
'\d+\%'
coverage_results.out |
tail
-1
)
"
COVERAGE_RATIO
=
"
$(
grep
-oP
'\d+\%'
coverage_results.out |
tail
-1
)
"
COVERAGE_RATIO
=
"
$(
echo
${
COVERAGE_RATIO
}
|
(
grep
-oP
'\d*'
)
)
"
COVERAGE_RATIO
=
"
$(
echo
"
${
COVERAGE_RATIO
}
"
|
(
grep
-oP
'\d*'
)
)
"
# report
# report
if
[[
${
IS_FAILED
}
==
0
]]
;
then
if
[[
${
IS_FAILED
}
-eq
0
]]
;
then
if
[[
${
COVERAGE_RATIO
}
-lt
${
COVERAGE_PASS_THRESHOLD
}
]]
;
then
if
[[
${
COVERAGE_RATIO
}
-lt
${
COVERAGE_PASS_THRESHOLD
}
]]
;
then
echo
"only
${
COVERAGE_RATIO
}
% covered"
echo
"only
${
COVERAGE_RATIO
}
% covered"
echo
"incomplete"
>
status.txt
echo
"incomplete"
>
status.txt
...
...
This diff is collapsed.
Click to expand it.
src/helpers.py
+
2
−
3
View file @
77e61dc6
...
@@ -9,13 +9,12 @@ import logging
...
@@ -9,13 +9,12 @@ import logging
import
math
import
math
import
os
import
os
import
socket
import
socket
import
sys
import
time
import
time
import
keras.backend
as
K
import
keras.backend
as
K
import
xarray
as
xr
import
xarray
as
xr
from
typing
import
Dict
,
Callable
from
typing
import
Dict
,
Callable
,
Pattern
,
Union
def
to_list
(
arg
):
def
to_list
(
arg
):
...
@@ -157,7 +156,7 @@ def set_bootstrap_path(bootstrap_path, data_path, sampling):
...
@@ -157,7 +156,7 @@ def set_bootstrap_path(bootstrap_path, data_path, sampling):
class
PyTestRegex
:
class
PyTestRegex
:
"""
Assert that a given string meets some expectations.
"""
"""
Assert that a given string meets some expectations.
"""
def
__init__
(
self
,
pattern
:
str
,
flags
:
int
=
0
):
def
__init__
(
self
,
pattern
:
Union
[
str
,
Pattern
]
,
flags
:
int
=
0
):
self
.
_regex
=
re
.
compile
(
pattern
,
flags
)
self
.
_regex
=
re
.
compile
(
pattern
,
flags
)
def
__eq__
(
self
,
actual
:
str
)
->
bool
:
def
__eq__
(
self
,
actual
:
str
)
->
bool
:
...
...
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