diff --git a/pavelib/tests.py b/pavelib/tests.py index 8598d2f2ba..f8bb8b7d81 100644 --- a/pavelib/tests.py +++ b/pavelib/tests.py @@ -331,12 +331,14 @@ def coverage(): report_dir = Env.REPORT_DIR rcfile = Env.PYTHON_COVERAGERC - if not (report_dir / '.coverage').isfile(): + combined_report_file = report_dir / '{}.coverage'.format(os.environ.get('TEST_SUITE', '')) + + if not combined_report_file.isfile(): # This may be that the coverage files were generated using -p, # try to combine them to the one file that we need. sh(u"coverage combine --rcfile={}".format(rcfile)) - if not os.path.getsize(report_dir / '.coverage') > 50: + if not os.path.getsize(combined_report_file) > 50: # Check if the .coverage data file is larger than the base file, # because coverage combine will always at least make the "empty" data # file even when there isn't any data to be combined. diff --git a/scripts/jenkins-report.sh b/scripts/jenkins-report.sh index 801920e9c1..904834e6b0 100755 --- a/scripts/jenkins-report.sh +++ b/scripts/jenkins-report.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash set -e +set -x # This script generates coverage and diff cover reports, and optionally # reports this data to codecov.io. The following environment variables must be @@ -14,6 +15,10 @@ source scripts/jenkins-common.sh # Get the diff coverage and html reports for unit tests paver coverage -b $TARGET_BRANCH +if [[ -n "$PYTEST_CONTEXTS" ]]; then + paver upload_coverage_to_s3 +fi + # Test for the CodeCov API token if [ -z $CODE_COV_TOKEN ]; then echo "codecov.io API token not set." @@ -27,7 +32,3 @@ fi # JUnit test reporter will fail the build # if it thinks test results are old touch `find . -name *.xml` || true - -if [[ -n "$PYTEST_CONTEXTS" ]]; then - paver upload_coverage_to_s3 -fi