summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2020-03-06 15:14:59 -0800
committerMatt Clay <matt@mystile.com>2020-03-10 13:49:35 -0700
commit8fffbecc815576b29bf4f7da1cac7d8eaab9d2a0 (patch)
treef48b5b9c46e69246d6e9c93e58f1235a91e31ca9
parentb54189c45b7736a34449b8d28825bc52fde7d7ef (diff)
downloadansible-8fffbecc815576b29bf4f7da1cac7d8eaab9d2a0.tar.gz
Fix ansible-test handling of no Python coverage.
-rw-r--r--changelogs/fragments/ansible-test-empty-coverage.yml2
-rw-r--r--test/lib/ansible_test/_internal/coverage/combine.py7
2 files changed, 7 insertions, 2 deletions
diff --git a/changelogs/fragments/ansible-test-empty-coverage.yml b/changelogs/fragments/ansible-test-empty-coverage.yml
new file mode 100644
index 0000000000..63dda10297
--- /dev/null
+++ b/changelogs/fragments/ansible-test-empty-coverage.yml
@@ -0,0 +1,2 @@
+bugfixes:
+ - ansible-test no longer errors reporting coverage when no Python coverage exists. This fixes issues reporting on PowerShell only coverage from collections.
diff --git a/test/lib/ansible_test/_internal/coverage/combine.py b/test/lib/ansible_test/_internal/coverage/combine.py
index bb2474b1a0..28986b2354 100644
--- a/test/lib/ansible_test/_internal/coverage/combine.py
+++ b/test/lib/ansible_test/_internal/coverage/combine.py
@@ -110,8 +110,11 @@ def _command_coverage_combine_python(args):
if not args.explain:
output_file = coverage_file + group
- updated.write_file(output_file)
- output_files.append(output_file)
+ updated.write_file(output_file) # always write files to make sure stale files do not exist
+
+ if updated:
+ # only report files which are non-empty to prevent coverage from reporting errors
+ output_files.append(output_file)
path_checker.report()