Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# A convenience equality, so that I can put strings in unit test
# results, and they will compare equal to objects.
return (other == "" % self.cmd)
__hash__ = None # This object doesn't need to be hashed.
def get_prog_name(self):
"""Override of an undocumented function in optparse.OptionParser."""
program_name = super(CmdOptionParser, self).get_prog_name()
# Include the sub-command for this parser as part of the command.
return "{command} {subcommand}".format(command=program_name, subcommand=self.cmd)
GLOBAL_ARGS = [
Opts.debug,
Opts.help,
Opts.rcfile,
]
CMDS = {
'annotate': CmdOptionParser(
"annotate",
[
Opts.directory,
Opts.ignore_errors,
Opts.include,
Opts.omit,
] + GLOBAL_ARGS,
usage="[options] [modules]",
description=(
"Make annotated copies of the given files, marking statements that are executed "
# Include the sub-command for this parser as part of the command.
return "{command} {subcommand}".format(command=program_name, subcommand=self.cmd)
GLOBAL_ARGS = [
Opts.debug,
Opts.help,
Opts.rcfile,
]
CMDS = {
'annotate': CmdOptionParser(
"annotate",
[
Opts.directory,
Opts.ignore_errors,
Opts.include,
Opts.omit,
] + GLOBAL_ARGS,
usage="[options] [modules]",
description=(
"Make annotated copies of the given files, marking statements that are executed "
"with > and statements that are missed with !."
),
),
'combine': CmdOptionParser(
"combine",
[
Opts.append,
] + GLOBAL_ARGS,
description="Describe how to use coverage.py",
),
'html': CmdOptionParser(
"html",
[
Opts.contexts,
Opts.directory,
Opts.fail_under,
Opts.ignore_errors,
Opts.include,
Opts.omit,
Opts.show_contexts,
Opts.skip_covered,
Opts.skip_empty,
Opts.title,
] + GLOBAL_ARGS,
usage="[options] [modules]",
description=(
"Create an HTML report of the coverage of the files. "
"Each file gets its own page, with the source decorated to show "
"executed, excluded, and missed lines."
),
),
'json': CmdOptionParser(
"json",
[
Opts.contexts,
Opts.fail_under,
Opts.ignore_errors,
Opts.include,
Opts.ignore_errors,
Opts.include,
Opts.omit,
Opts.show_missing,
Opts.skip_covered,
Opts.skip_empty,
] + GLOBAL_ARGS,
usage="[options] [modules]",
description="Report coverage statistics on modules."
),
'run': CmdOptionParser(
"run",
[
Opts.append,
Opts.branch,
Opts.concurrency,
Opts.context,
Opts.include,
Opts.module,
Opts.omit,
Opts.pylib,
Opts.parallel_mode,
Opts.source,
Opts.timid,
] + GLOBAL_ARGS,
usage="[options] [program options]",
description="Run a Python program, measuring code execution."
),
'xml': CmdOptionParser(
"xml",
Opts.ignore_errors,
Opts.include,
Opts.omit,
Opts.output_json,
Opts.json_pretty_print,
Opts.show_contexts,
] + GLOBAL_ARGS,
usage="[options] [modules]",
description="Generate a JSON report of coverage results."
),
'report': CmdOptionParser(
"report",
[
Opts.contexts,
Opts.fail_under,
Opts.ignore_errors,
Opts.include,
Opts.omit,
Opts.show_missing,
Opts.skip_covered,
Opts.skip_empty,
] + GLOBAL_ARGS,
usage="[options] [modules]",
description="Report coverage statistics on modules."
),
'run': CmdOptionParser(
"run",
[
Opts.append,
Opts.branch,
Opts.omit,
Opts.output_json,
Opts.json_pretty_print,
Opts.show_contexts,
] + GLOBAL_ARGS,
usage="[options] [modules]",
description="Generate a JSON report of coverage results."
),
'report': CmdOptionParser(
"report",
[
Opts.contexts,
Opts.fail_under,
Opts.ignore_errors,
Opts.include,
Opts.omit,
Opts.show_missing,
Opts.skip_covered,
Opts.skip_empty,
] + GLOBAL_ARGS,
usage="[options] [modules]",
description="Report coverage statistics on modules."
),
'run': CmdOptionParser(
"run",
[
Opts.append,
Opts.branch,
Opts.concurrency,
Opts.context,
] + GLOBAL_ARGS,
usage="[options] [modules]",
description="Report coverage statistics on modules."
),
'run': CmdOptionParser(
"run",
[
Opts.append,
Opts.branch,
Opts.concurrency,
Opts.context,
Opts.include,
Opts.module,
Opts.omit,
Opts.pylib,
Opts.parallel_mode,
Opts.source,
Opts.timid,
] + GLOBAL_ARGS,
usage="[options] [program options]",
description="Run a Python program, measuring code execution."
),
'xml': CmdOptionParser(
"xml",
[
Opts.fail_under,
Opts.ignore_errors,
Opts.include,
Opts.omit,
Opts.output_xml,
return (other == "" % self.cmd)
__hash__ = None # This object doesn't need to be hashed.
def get_prog_name(self):
"""Override of an undocumented function in optparse.OptionParser."""
program_name = super(CmdOptionParser, self).get_prog_name()
# Include the sub-command for this parser as part of the command.
return "{command} {subcommand}".format(command=program_name, subcommand=self.cmd)
GLOBAL_ARGS = [
Opts.debug,
Opts.help,
Opts.rcfile,
]
CMDS = {
'annotate': CmdOptionParser(
"annotate",
[
Opts.directory,
Opts.ignore_errors,
Opts.include,
Opts.omit,
] + GLOBAL_ARGS,
usage="[options] [modules]",
description=(
"Make annotated copies of the given files, marking statements that are executed "
"with > and statements that are missed with !."
),
def __init__(self):
super(GlobalOptionParser, self).__init__()
self.add_options([
Opts.help,
Opts.version,
])
"Each file gets its own page, with the source decorated to show "
"executed, excluded, and missed lines."
),
),
'json': CmdOptionParser(
"json",
[
Opts.contexts,
Opts.fail_under,
Opts.ignore_errors,
Opts.include,
Opts.omit,
Opts.output_json,
Opts.json_pretty_print,
Opts.show_contexts,
] + GLOBAL_ARGS,
usage="[options] [modules]",
description="Generate a JSON report of coverage results."
),
'report': CmdOptionParser(
"report",
[
Opts.contexts,
Opts.fail_under,
Opts.ignore_errors,
Opts.include,
Opts.omit,
Opts.show_missing,
Opts.skip_covered,
Opts.skip_empty,