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 26, 2024
1 parent 7c4af2d commit 091f459
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions selftests/run_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ echo "Using coverage utility: $COVERAGE"

$COVERAGE erase
rm -f .coverage.*
export COVERAGE_PROCESS_START=.coveragerc
$COVERAGE run selftests/check.py --skip=static-checks
$COVERAGE combine
echo
Expand Down
2 changes: 2 additions & 0 deletions sitecustomize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import coverage
coverage.process_startup()

0 comments on commit 091f459

Please sign in to comment.