mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add --include and --omit options to ansible-test coverage report (#38061)
* Support --include and --omit with ansible-test coverage report * Code format change
This commit is contained in:
parent
9b1e97424e
commit
a19a21d715
3 changed files with 17 additions and 0 deletions
|
@ -246,3 +246,5 @@ class CoverageReportConfig(CoverageConfig):
|
||||||
super(CoverageReportConfig, self).__init__(args)
|
super(CoverageReportConfig, self).__init__(args)
|
||||||
|
|
||||||
self.show_missing = args.show_missing # type: bool
|
self.show_missing = args.show_missing # type: bool
|
||||||
|
self.include = args.include # type: str
|
||||||
|
self.omit = args.omit # type: str
|
||||||
|
|
|
@ -154,6 +154,12 @@ def command_coverage_report(args):
|
||||||
if args.show_missing:
|
if args.show_missing:
|
||||||
options.append('--show-missing')
|
options.append('--show-missing')
|
||||||
|
|
||||||
|
if args.include:
|
||||||
|
options.extend(['--include', args.include])
|
||||||
|
|
||||||
|
if args.omit:
|
||||||
|
options.extend(['--omit', args.omit])
|
||||||
|
|
||||||
env = common_environment()
|
env = common_environment()
|
||||||
env.update(dict(COVERAGE_FILE=output_file))
|
env.update(dict(COVERAGE_FILE=output_file))
|
||||||
run_command(args, env=env, cmd=['coverage', 'report'] + options)
|
run_command(args, env=env, cmd=['coverage', 'report'] + options)
|
||||||
|
|
|
@ -397,6 +397,15 @@ def parse_args():
|
||||||
coverage_report.add_argument('--show-missing',
|
coverage_report.add_argument('--show-missing',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='show line numbers of statements not executed')
|
help='show line numbers of statements not executed')
|
||||||
|
coverage_report.add_argument('--include',
|
||||||
|
metavar='PAT1,PAT2,...',
|
||||||
|
help='include only files whose paths match one of these '
|
||||||
|
'patterns. Accepts shell-style wildcards, which must be '
|
||||||
|
'quoted.')
|
||||||
|
coverage_report.add_argument('--omit',
|
||||||
|
metavar='PAT1,PAT2,...',
|
||||||
|
help='omit files whose paths match one of these patterns. '
|
||||||
|
'Accepts shell-style wildcards, which must be quoted.')
|
||||||
|
|
||||||
add_extra_coverage_options(coverage_report)
|
add_extra_coverage_options(coverage_report)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue