summaryrefslogtreecommitdiffstats
path: root/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/combine-coverage.py
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/combine-coverage.py')
-rwxr-xr-xansible_collections/hetzner/hcloud/.azure-pipelines/scripts/combine-coverage.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/combine-coverage.py b/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/combine-coverage.py
index 506ade646..bab3c4226 100755
--- a/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/combine-coverage.py
+++ b/ansible_collections/hetzner/hcloud/.azure-pipelines/scripts/combine-coverage.py
@@ -7,8 +7,7 @@ Keep in mind that Azure Pipelines does not enforce unique job display names (onl
It is up to pipeline authors to avoid name collisions when deviating from the recommended format.
"""
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
import os
import re
@@ -20,12 +19,12 @@ def main():
"""Main program entry point."""
source_directory = sys.argv[1]
- if '/ansible_collections/' in os.getcwd():
+ if "/ansible_collections/" in os.getcwd():
output_path = "tests/output"
else:
output_path = "test/results"
- destination_directory = os.path.join(output_path, 'coverage')
+ destination_directory = os.path.join(output_path, "coverage")
if not os.path.exists(destination_directory):
os.makedirs(destination_directory)
@@ -34,27 +33,27 @@ def main():
count = 0
for name in os.listdir(source_directory):
- match = re.search('^Coverage (?P<attempt>[0-9]+) (?P<label>.+)$', name)
- label = match.group('label')
- attempt = int(match.group('attempt'))
+ match = re.search("^Coverage (?P<attempt>[0-9]+) (?P<label>.+)$", name)
+ label = match.group("label")
+ attempt = int(match.group("attempt"))
jobs[label] = max(attempt, jobs.get(label, 0))
for label, attempt in jobs.items():
- name = 'Coverage {attempt} {label}'.format(label=label, attempt=attempt)
+ name = f"Coverage {attempt} {label}"
source = os.path.join(source_directory, name)
source_files = os.listdir(source)
for source_file in source_files:
source_path = os.path.join(source, source_file)
- destination_path = os.path.join(destination_directory, source_file + '.' + label)
- print('"%s" -> "%s"' % (source_path, destination_path))
+ destination_path = os.path.join(destination_directory, source_file + "." + label)
+ print(f'"{source_path}" -> "{destination_path}"')
shutil.copyfile(source_path, destination_path)
count += 1
- print('Coverage file count: %d' % count)
- print('##vso[task.setVariable variable=coverageFileCount]%d' % count)
- print('##vso[task.setVariable variable=outputPath]%s' % output_path)
+ print("Coverage file count: %d" % count)
+ print("##vso[task.setVariable variable=coverageFileCount]%d" % count)
+ print("##vso[task.setVariable variable=outputPath]%s" % output_path)
-if __name__ == '__main__':
+if __name__ == "__main__":
main()