mirror of
https://github.com/ansible/ansible.git
synced 2026-08-03 08:03:05 +02:00
ansible-test - Fix code coverage reporting. (#75771)
This commit is contained in:
@@ -67,10 +67,11 @@ def command_coverage_combine(args):
|
||||
:rtype: list[str]
|
||||
"""
|
||||
host_state = prepare_profiles(args) # coverage combine
|
||||
combine_coverage_files(args, host_state)
|
||||
|
||||
if args.delegate:
|
||||
raise Delegate(host_state)
|
||||
|
||||
def combine_coverage_files(args, host_state): # type: (CoverageCombineConfig, HostState) -> t.List[str]
|
||||
"""Combine coverage and return a list of the resulting files."""
|
||||
if args.delegate:
|
||||
if isinstance(args.controller, (DockerConfig, RemoteConfig)):
|
||||
paths = get_all_coverage_files()
|
||||
|
||||
@@ -20,7 +20,7 @@ from ...provisioning import (
|
||||
)
|
||||
|
||||
from .combine import (
|
||||
command_coverage_combine,
|
||||
combine_coverage_files,
|
||||
CoverageCombineConfig,
|
||||
)
|
||||
|
||||
@@ -34,7 +34,7 @@ def command_coverage_html(args):
|
||||
:type args: CoverageHtmlConfig
|
||||
"""
|
||||
host_state = prepare_profiles(args) # coverage html
|
||||
output_files = command_coverage_combine(args)
|
||||
output_files = combine_coverage_files(args, host_state)
|
||||
|
||||
for output_file in output_files:
|
||||
if output_file.endswith('-powershell'):
|
||||
|
||||
@@ -20,7 +20,7 @@ from ...provisioning import (
|
||||
)
|
||||
|
||||
from .combine import (
|
||||
command_coverage_combine,
|
||||
combine_coverage_files,
|
||||
CoverageCombineConfig,
|
||||
)
|
||||
|
||||
@@ -34,7 +34,7 @@ def command_coverage_report(args):
|
||||
:type args: CoverageReportConfig
|
||||
"""
|
||||
host_state = prepare_profiles(args) # coverage report
|
||||
output_files = command_coverage_combine(args)
|
||||
output_files = combine_coverage_files(args, host_state)
|
||||
|
||||
for output_file in output_files:
|
||||
if args.group_by or args.stub:
|
||||
|
||||
@@ -38,7 +38,7 @@ from ...provisioning import (
|
||||
)
|
||||
|
||||
from .combine import (
|
||||
command_coverage_combine,
|
||||
combine_coverage_files,
|
||||
CoverageCombineConfig,
|
||||
)
|
||||
|
||||
@@ -52,7 +52,7 @@ def command_coverage_xml(args):
|
||||
:type args: CoverageXmlConfig
|
||||
"""
|
||||
host_state = prepare_profiles(args) # coverage xml
|
||||
output_files = command_coverage_combine(args)
|
||||
output_files = combine_coverage_files(args, host_state)
|
||||
|
||||
for output_file in output_files:
|
||||
xml_name = '%s.xml' % os.path.basename(output_file)
|
||||
|
||||
@@ -369,6 +369,9 @@ class DockerProfile(ControllerHostProfile[DockerConfig], SshTargetHostProfile[Do
|
||||
|
||||
def deprovision(self): # type: () -> None
|
||||
"""Deprovision the host after delegation has completed."""
|
||||
if not self.container_name:
|
||||
return # provision was never called or did not succeed, so there is no container to remove
|
||||
|
||||
if self.args.docker_terminate == TerminateMode.ALWAYS or (self.args.docker_terminate == TerminateMode.SUCCESS and self.args.success):
|
||||
docker_rm(self.args, self.container_name)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user