diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/ansible_test/_internal/cli.py | 6 | ||||
-rw-r--r-- | test/lib/ansible_test/_internal/cover.py | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/test/lib/ansible_test/_internal/cli.py b/test/lib/ansible_test/_internal/cli.py index 474a30d341..9d41c1b694 100644 --- a/test/lib/ansible_test/_internal/cli.py +++ b/test/lib/ansible_test/_internal/cli.py @@ -505,6 +505,9 @@ def parse_args(): coverage_combine.set_defaults(func=command_coverage_combine, config=CoverageConfig) + coverage_combine.add_argument('--export', + help='directory to export combined coverage files to') + add_extra_coverage_options(coverage_combine) coverage_erase = coverage_subparsers.add_parser('erase', @@ -760,9 +763,6 @@ def add_extra_coverage_options(parser): action='store_true', 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): """ diff --git a/test/lib/ansible_test/_internal/cover.py b/test/lib/ansible_test/_internal/cover.py index ad413a44df..4d16e25e4b 100644 --- a/test/lib/ansible_test/_internal/cover.py +++ b/test/lib/ansible_test/_internal/cover.py @@ -138,6 +138,9 @@ def _command_coverage_combine_python(args): if not filename: continue + 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: groups[group] = {} @@ -313,6 +316,8 @@ def _sanitise_filename(filename, modules=None, collection_search_re=None, collec display.info('%s -> %s' % (filename, new_name), verbosity=3) filename = new_name + filename = os.path.abspath(filename) # make sure path is absolute (will be relative if previously exported) + return filename @@ -510,6 +515,9 @@ def _command_coverage_combine_powershell(args): if not filename: continue + if args.export: + filename = os.path.relpath(filename) # exported paths must be relative since absolute paths may differ between systems + if isinstance(hit_info, dict) and not hit_info.get('Line'): # Input data was previously aggregated and thus uses the standard ansible-test output format for PowerShell coverage. # This format differs from the more verbose format of raw coverage data from the remote Windows hosts. |