Skip to content
Snippets Groups Projects
Commit 64c5eb2f authored by Anton Joubert's avatar Anton Joubert
Browse files

Add coverage to Jenkins test results

Determine coverage and generate an HTML report that is stored as
an artifact on Jenkins.

JIRA: LMC-449
parent 42775754
No related branches found
No related tags found
No related merge requests found
[run]
omit =
*test*
setup.py
release.py
...@@ -26,6 +26,7 @@ pip-log.txt ...@@ -26,6 +26,7 @@ pip-log.txt
.cache .cache
nosetests.xml nosetests.xml
results.xml results.xml
htmlcov
# Developer tools # Developer tools
*~ *~
......
...@@ -29,6 +29,7 @@ node('docker') { ...@@ -29,6 +29,7 @@ node('docker') {
// use Ansible to do pip installs, using current WORKSPACE // use Ansible to do pip installs, using current WORKSPACE
// as the software_root // as the software_root
// install coverage manually, so it can be used after tests
sh ''' sh '''
PARENT_DIR=`dirname $WORKSPACE` PARENT_DIR=`dirname $WORKSPACE`
cd ansible cd ansible
...@@ -38,17 +39,20 @@ node('docker') { ...@@ -38,17 +39,20 @@ node('docker') {
--tags install-sw-skabase \ --tags install-sw-skabase \
--verbose \ --verbose \
--extra-vars software_root=$PARENT_DIR --extra-vars software_root=$PARENT_DIR
pip install coverage
cd .. cd ..
''' '''
// run tests // run tests, and generate HTML coverage report
sh ''' sh '''
python setup.py test \ python setup.py test \
--addopts="--junitxml results.xml --color=yes" --addopts="--junitxml results.xml --color=yes --cov=skabase --cov=refelt --cov-report=term --cov-config .coveragerc"
coverage html
''' '''
} }
finally { finally {
step([$class: 'JUnitResultArchiver', testResults: 'results.xml']) step([$class: 'JUnitResultArchiver', testResults: 'results.xml'])
archive 'htmlcov/*'
} }
} }
} }
......
...@@ -44,12 +44,12 @@ setup(name="levpro", ...@@ -44,12 +44,12 @@ setup(name="levpro",
tests_require=[ tests_require=[
"coverage", "coverage",
"pytest", "pytest",
'pytest-xdist', "pytest-cov",
"pytest-xdist",
"python-devicetest", "python-devicetest",
"unittest2" "unittest2"
], ],
dependency_links=[ dependency_links=[
'git+https://github.com/vxgmichel/pytango-devicetest.git#egg=python_devicetest'], 'git+https://github.com/vxgmichel/pytango-devicetest.git#egg=python_devicetest'],
keywords="levpro lmc ska", keywords="levpro lmc ska",
test_suite="nose.collector",
zip_safe=False) zip_safe=False)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment