Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gitlab_shared_files
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
aidge
gitlab_shared_files
Commits
d13a855f
Commit
d13a855f
authored
1 month ago
by
Cyril Moineau
Browse files
Options
Downloads
Patches
Plain Diff
Fuse test and coverage for python.
parent
4beeae32
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab/ci/ubuntu_python.gitlab-ci.yml
+17
-33
17 additions, 33 deletions
.gitlab/ci/ubuntu_python.gitlab-ci.yml
with
17 additions
and
33 deletions
.gitlab/ci/ubuntu_python.gitlab-ci.yml
+
17
−
33
View file @
d13a855f
...
...
@@ -37,12 +37,11 @@ build:ubuntu_python:
####################################################################################################
# TEST
####################################################################################################
.setup:test:ubuntu_python
:
before_script
:
-
!reference
[
.retrieve_deps
:
apt
,
script
]
-
source venv/bin/activate
-
python -m pip install pytest
-
python -m pip install pytest
pytest-cov
-
which python
-
python -m pip list
...
...
@@ -50,55 +49,40 @@ test:ubuntu_python:
stage
:
test
needs
:
[
"
build:ubuntu_python"
]
rules
:
-
when
:
on_success
-
allow_failure
:
false
-
when
:
on_success
tags
:
-
docker
extends
:
.setup:test:ubuntu_python
script
:
-
cd ${CI_PROJECT_NAME}
# Run on discovery all tests located in project/unit_tests/python and discard the stdout
# only to show the errors/warnings and the results of the tests
# - python -m xmlrunner discover -s unit_tests/ -v -b --output-file xmlrunner-results.xml
-
pytest unit_tests/ -v --junitxml=xmlrunner-results.xml
# Run tests with coverage, produce JUnit and coverage XML reports
-
pytest unit_tests/ -v --junitxml=xmlrunner-results.xml --cov=${CI_PROJECT_NAME} --cov-report=xml:coverage.xml --cov-report=term
artifacts
:
reports
:
junit
:
${CI_PROJECT_NAME}/xmlrunner-results.xml
coverage_report
:
coverage_format
:
cobertura
path
:
coverage.xml
####################################################################################################
# COVERAGE
####################################################################################################
#
####################################################################################################
#
# COVERAGE
#
####################################################################################################
.setup:coverage:ubuntu_python
:
before_script
:
-
!reference
[
.retrieve_deps
:
apt
,
script
]
-
source venv/bin/activate
-
which python
-
python -m pip list
-
python -m pip install numpy coverage requests pytest
-
echo "WARNING
:
The .setup:coverage:ubuntu_python job is deprecated and will be removed in future versions."
coverage:ubuntu_python
:
stage
:
coverage
needs
:
[
"
build:ubuntu_python"
]
extends
:
-
.rules:static_analysis_coverage
-
.setup:coverage:ubuntu_python
rules
:
-
when
:
always
tags
:
-
docker
script
:
-
cd ${CI_PROJECT_NAME}
# Retrieve the installation path of the module, since it is installed with pip.
-
export MODULE_LOCATION=`python -c "import ${CI_PROJECT_NAME} as _; print(_.__path__[0])"`
-
python -m coverage run --source=$MODULE_LOCATION -m pytest unit_tests/ -v
-
python -m coverage report
-
python -m coverage xml
coverage
:
'
/(?i)total.*?
(100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts
:
expire_in
:
3 days
reports
:
coverage_report
:
coverage_format
:
cobertura
path
:
${CI_PROJECT_NAME}/coverage.xml
-
echo "WARNING
:
The coverage:ubuntu_python job is deprecated and will be removed in future versions."
-
echo "Please run tests with coverage in the test:ubuntu_python job instead."
allow_failure
:
true
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