Merge "Enable test coverage in run_test.sh and tox"

This commit is contained in:
Jenkins 2016-09-13 13:39:14 +00:00 committed by Gerrit Code Review
commit 38d4423bb3
3 changed files with 14 additions and 3 deletions

3
.gitignore vendored
View File

@ -12,3 +12,6 @@ npm-debug.log
*.lock
*.egg*
*.swp
.coverage
coverage.xml
htmlcov

View File

@ -365,6 +365,10 @@ function run_tests_all {
if [ "$NOSE_WITH_HTML_OUTPUT" = '1' ]; then
export NOSE_HTML_OUT_FILE='dashboard_nose_results.html'
fi
if [ $with_coverage -eq 1 ]; then
${command_wrapper} python -m coverage.__main__ erase
coverage_run="python -m coverage.__main__ run -p"
fi
${command_wrapper} ${coverage_run} $root/manage.py test magnum_ui --settings=openstack_dashboard.test.settings $testopts
# get results of the openstack_dashboard tests
DASHBOARD_RESULT=$?
@ -372,8 +376,8 @@ function run_tests_all {
if [ $with_coverage -eq 1 ]; then
echo "Generating coverage reports"
${command_wrapper} python -m coverage.__main__ combine
${command_wrapper} python -m coverage.__main__ xml -i --include="horizon/*,openstack_dashboard/*" --omit='/usr*,setup.py,*egg*,.venv/*'
${command_wrapper} python -m coverage.__main__ html -i --include="horizon/*,openstack_dashboard/*" --omit='/usr*,setup.py,*egg*,.venv/*' -d reports
${command_wrapper} python -m coverage.__main__ xml -i --include="magnum_ui/*" --omit='/usr*,setup.py,*egg*,.venv/*'
${command_wrapper} python -m coverage.__main__ html -i --include="magnum_ui/*" --omit='/usr*,setup.py,*egg*,.venv/*' -d reports
fi
# Remove the leftover coverage files from the -p flag earlier.
rm -f .coverage.*

View File

@ -23,7 +23,11 @@ commands = flake8 {posargs}
commands = {posargs}
[testenv:cover]
commands = python setup.py test --coverage --testr-args='{posargs}'
commands =
coverage erase
coverage run {toxinidir}/manage.py test magnum_ui --settings=magnum_ui.test.settings {posargs} --exclude-dir=magnum_ui/test/integration_tests {posargs}
coverage xml --omit '.tox/cover/*'
coverage html --omit '.tox/cover/*'
[testenv:py27dj18]
basepython = python2.7