Use "python -m coverage" rather than use "coverage" explicitly

When coverage module is installed using a package from Debian/Ubuntu,
the command name is "python-coverage". By using "python -m coverage"
the coverage module is detected in both cases.

Change-Id: Icf9084855b83d0cc721de5325f38cf72ac85ff81
Closes-Bug: #1241332
Co-Authored-By: florent <florent.flament-ext@cloudwatt.com>
This commit is contained in:
Maxime Vidori 2014-04-09 18:38:05 +02:00
parent 198dba6a2d
commit d2d2e5b6a1
1 changed files with 5 additions and 5 deletions

View File

@ -319,8 +319,8 @@ function run_tests_all {
export NOSE_HTML_OUT_FILE='horizon_nose_results.html'
fi
if [ $with_coverage -eq 1 ]; then
${command_wrapper} coverage erase
coverage_run="coverage run -p"
${command_wrapper} python -m coverage.__main__ erase
coverage_run="python -m coverage.__main__ run -p"
fi
${command_wrapper} ${coverage_run} $root/manage.py test horizon --settings=horizon.test.settings $testopts
# get results of the Horizon tests
@ -337,9 +337,9 @@ function run_tests_all {
if [ $with_coverage -eq 1 ]; then
echo "Generating coverage reports"
${command_wrapper} coverage combine
${command_wrapper} coverage xml -i --include="horizon/*,openstack_dashboard/*" --omit='/usr*,setup.py,*egg*,.venv/*'
${command_wrapper} coverage html -i --include="horizon/*,openstack_dashboard/*" --omit='/usr*,setup.py,*egg*,.venv/*' -d 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
fi
# Remove the leftover coverage files from the -p flag earlier.
rm -f .coverage.*