Fix coverage option for run_tests.sh
This commit fixes run_tests.sh so that when the -c flag is specified
coverage will actually be collected. Previously the --coverage option
was added to testrargs, however this isn't a testr flag. It is used by
pbr to wrap testr with coverage start and coverage report. This changes
run_tests() so that when coverage is specified it runs the unit tests
using setup.py so that the coverage flag can be used.
Change-Id: Iad0d508b6a4638a67e45646148144f627588fa48
diff --git a/run_tests.sh b/run_tests.sh
index eaa7fd7..2d3f4fd 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -84,6 +84,11 @@
return $?
fi
+ if [ $coverage -eq 1 ]; then
+ ${wrapper} python setup.py test --coverage
+ return $?
+ fi
+
if [ $serial -eq 1 ]; then
${wrapper} testr run --subunit $testrargs | ${wrapper} subunit-2to1 | ${wrapper} tools/colorizer.py
else
@@ -135,10 +140,6 @@
exit
fi
-if [ $coverage -eq 1 ]; then
- $testrargs = "--coverage $testrargs"
-fi
-
run_tests
retval=$?