Skip to content

Commit

Permalink
Test coverage with multiprocessing fix
Browse files Browse the repository at this point in the history
The test coverage of avocado gathered by coverage.py. It was not
precise, because some of our functional tests were running in
sub-processes where the coverage was not enabled. This change it adds
`sitecustomize.py` to ensure that coverage will be enabled for all
python processes which will run during coverage testing. After this
change, the overall test coverage of avocado will increase from 54%
to 68%

Reference: https://coverage.readthedocs.io/en/latest/subprocess.html
Signed-off-by: Jan Richter <[email protected]>
  • Loading branch information
richtja committed Nov 27, 2024
1 parent 7c4af2d commit cee5223
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[run]
source = avocado/, optional_plugins/
concurrency = multiprocessing
parallel = true
4 changes: 3 additions & 1 deletion selftests/run_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ echo "Using coverage utility: $COVERAGE"

$COVERAGE erase
rm -f .coverage.*
$COVERAGE run selftests/check.py --skip=static-checks
echo -e "import coverage\ncoverage.process_startup()" >> sitecustomize.py
env COVERAGE_PROCESS_START=.coveragerc $COVERAGE run selftests/check.py --skip=static-checks
rm -f sitecustomize.py
$COVERAGE combine
echo
$COVERAGE report -m --include "avocado/core/*"
Expand Down

0 comments on commit cee5223

Please sign in to comment.