1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add ansible-test coverage report --show-missing.

This commit is contained in:
Matt Clay 2017-07-05 10:24:56 -07:00
parent 37508fde5f
commit fba76444e0
2 changed files with 23 additions and 3 deletions

View file

@ -137,7 +137,7 @@ def command_coverage_combine(args):
def command_coverage_report(args):
"""
:type args: CoverageConfig
:type args: CoverageReportConfig
"""
output_files = command_coverage_combine(args)
@ -145,9 +145,14 @@ def command_coverage_report(args):
if args.group_by or args.stub:
display.info('>>> Coverage Group: %s' % ' '.join(os.path.basename(output_file).split('=')[1:]))
options = []
if args.show_missing:
options.append('--show-missing')
env = common_environment()
env.update(dict(COVERAGE_FILE=output_file))
run_command(args, env=env, cmd=['coverage', 'report'])
run_command(args, env=env, cmd=['coverage', 'report'] + options)
def command_coverage_html(args):
@ -252,3 +257,14 @@ class CoverageConfig(EnvironmentConfig):
self.group_by = frozenset(args.group_by) if 'group_by' in args and args.group_by else set() # type: frozenset[str]
self.all = args.all if 'all' in args else False # type: bool
self.stub = args.stub if 'stub' in args else False # type: bool
class CoverageReportConfig(CoverageConfig):
"""Configuration for the coverage report command."""
def __init__(self, args):
"""
:type args: any
"""
super(CoverageReportConfig, self).__init__(args)
self.show_missing = args.show_missing # type: bool

View file

@ -363,7 +363,11 @@ def parse_args():
help='generate console coverage report')
coverage_report.set_defaults(func=lib.cover.command_coverage_report,
config=lib.cover.CoverageConfig)
config=lib.cover.CoverageReportConfig)
coverage_report.add_argument('--show-missing',
action='store_true',
help='show line numbers of statements not executed')
add_extra_coverage_options(coverage_report)