Fix ansible-test coverage exporting.
ci_complete ci_coverage
This commit is contained in:
parent
846c2d1ed3
commit
b75844af45
4 changed files with 17 additions and 3 deletions
|
@ -0,0 +1,6 @@
|
||||||
|
bugfixes:
|
||||||
|
- ansible-test - The ``--export`` option for ``ansible-test coverage`` is now limited to the ``combine`` command.
|
||||||
|
It was previously available for reporting commands on which it had no effect.
|
||||||
|
- ansible-test - The ``ansible-test coverage combine`` option ``--export`` now exports relative paths.
|
||||||
|
This avoids loss of coverage data when aggregating across systems with different absolute paths.
|
||||||
|
Paths will be converted back to absolute when generating reports.
|
|
@ -576,6 +576,9 @@ def parse_args():
|
||||||
coverage_combine.set_defaults(func=command_coverage_combine,
|
coverage_combine.set_defaults(func=command_coverage_combine,
|
||||||
config=CoverageConfig)
|
config=CoverageConfig)
|
||||||
|
|
||||||
|
coverage_combine.add_argument('--export',
|
||||||
|
help='directory to export combined coverage files to')
|
||||||
|
|
||||||
add_extra_coverage_options(coverage_combine)
|
add_extra_coverage_options(coverage_combine)
|
||||||
|
|
||||||
coverage_erase = coverage_subparsers.add_parser('erase',
|
coverage_erase = coverage_subparsers.add_parser('erase',
|
||||||
|
@ -986,9 +989,6 @@ def add_extra_coverage_options(parser):
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='generate empty report of all python/powershell source files')
|
help='generate empty report of all python/powershell source files')
|
||||||
|
|
||||||
parser.add_argument('--export',
|
|
||||||
help='directory to export combined coverage files to')
|
|
||||||
|
|
||||||
|
|
||||||
def add_httptester_options(parser, argparse):
|
def add_httptester_options(parser, argparse):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -288,6 +288,8 @@ def sanitize_filename(
|
||||||
display.info('%s -> %s' % (filename, new_name), verbosity=3)
|
display.info('%s -> %s' % (filename, new_name), verbosity=3)
|
||||||
filename = new_name
|
filename = new_name
|
||||||
|
|
||||||
|
filename = os.path.abspath(filename) # make sure path is absolute (will be relative if previously exported)
|
||||||
|
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,9 @@ def _command_coverage_combine_python(args):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for filename, arcs in enumerate_python_arcs(coverage_file, coverage, modules, collection_search_re, collection_sub_re):
|
for filename, arcs in enumerate_python_arcs(coverage_file, coverage, modules, collection_search_re, collection_sub_re):
|
||||||
|
if args.export:
|
||||||
|
filename = os.path.relpath(filename) # exported paths must be relative since absolute paths may differ between systems
|
||||||
|
|
||||||
if group not in groups:
|
if group not in groups:
|
||||||
groups[group] = {}
|
groups[group] = {}
|
||||||
|
|
||||||
|
@ -157,6 +160,9 @@ def _command_coverage_combine_powershell(args):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for filename, hits in enumerate_powershell_lines(coverage_file, collection_search_re, collection_sub_re):
|
for filename, hits in enumerate_powershell_lines(coverage_file, collection_search_re, collection_sub_re):
|
||||||
|
if args.export:
|
||||||
|
filename = os.path.relpath(filename) # exported paths must be relative since absolute paths may differ between systems
|
||||||
|
|
||||||
if group not in groups:
|
if group not in groups:
|
||||||
groups[group] = {}
|
groups[group] = {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue