From cee5223eb3e6765dda742e9c005865a37967bd5a Mon Sep 17 00:00:00 2001 From: Jan Richter Date: Tue, 26 Nov 2024 15:13:59 +0100 Subject: [PATCH] Test coverage with multiprocessing fix 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 --- .coveragerc | 1 + selftests/run_coverage | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.coveragerc b/.coveragerc index 53d8d93c3c..0e241088a0 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,3 +1,4 @@ [run] source = avocado/, optional_plugins/ concurrency = multiprocessing +parallel = true diff --git a/selftests/run_coverage b/selftests/run_coverage index 7efad79263..89d54c4a52 100755 --- a/selftests/run_coverage +++ b/selftests/run_coverage @@ -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/*"