Bug 1457629 - Don't create per-test-coverage-reports.zip when no tests are run. r?marco
This patch stops test-coverage (TC/TCw) from trying to create a zip file of the per-test coverage reports when no tests are run.
MozReview-Commit-ID: 6m3TR4oUCLx
--- a/testing/mozharness/mozharness/mozilla/testing/codecoverage.py
+++ b/testing/mozharness/mozharness/mozilla/testing/codecoverage.py
@@ -284,16 +284,20 @@ class CodeCoverageMixin(SingleTestMixin)
self.info("Completed compression of JSDCov artifacts!")
self.info("Path to JSDCov compressed artifacts: " + zipFile)
if not self.code_coverage_enabled:
return
if self.per_test_coverage:
+ if not self.per_test_reports:
+ self.info("No tests were found...not saving coverage data.")
+ return
+
dest = os.path.join(dirs['abs_blob_upload_dir'], 'per-test-coverage-reports.zip')
with zipfile.ZipFile(dest, 'w', zipfile.ZIP_DEFLATED) as z:
for suite, data in self.per_test_reports.items():
for test, grcov_file in data.items():
with open(grcov_file, 'r') as f:
report = json.load(f)
# TODO: Diff this coverage report with the baseline one.