summaryrefslogtreecommitdiff
path: root/coverage/cmdline.py
diff options
context:
space:
mode:
authorBradley Burns <56638814+bradb423@users.noreply.github.com>2022-01-22 20:14:23 +0000
committerGitHub <noreply@github.com>2022-01-22 12:14:23 -0800
commitcbe2e205dac99f20afff4ccdeca21fd10d596565 (patch)
tree565406a74160d301741556397c43473e38459014 /coverage/cmdline.py
parent2cc2254581dad57719b155b4d349d4f6fdd65d2d (diff)
downloadpython-coveragepy-git-cbe2e205dac99f20afff4ccdeca21fd10d596565.tar.gz
feat: add "lcov" command for generating LCOV reports
* Add LCOV functionality into coverage.py * Add testing for the LCOV reporter * Add documentation for the LCOV reporter
Diffstat (limited to 'coverage/cmdline.py')
-rw-r--r--coverage/cmdline.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py
index efed9040..9f5c9ea8 100644
--- a/coverage/cmdline.py
+++ b/coverage/cmdline.py
@@ -127,6 +127,11 @@ class Opts:
'', '--pretty-print', action='store_true',
help="Format the JSON for human readers.",
)
+ lcov = optparse.make_option(
+ '-o', '', action='store', dest='outfile',
+ metavar="OUTFILE",
+ help="Write the LCOV report to this file. Defaults to 'coverage.lcov'"
+ )
parallel_mode = optparse.make_option(
'-p', '--parallel-mode', action='store_true',
help=(
@@ -473,6 +478,20 @@ CMDS = {
usage="[options] [modules]",
description="Generate an XML report of coverage results."
),
+
+ 'lcov': CmdOptionParser(
+ "lcov",
+ [
+ Opts.fail_under,
+ Opts.ignore_errors,
+ Opts.include,
+ Opts.lcov,
+ Opts.omit,
+ Opts.quiet,
+ ] + GLOBAL_ARGS,
+ usage="[options] [modules]",
+ description="Generate an LCOV report of coverage results."
+ )
}
@@ -657,6 +676,12 @@ class CoverageScript:
show_contexts=options.show_contexts,
**report_args
)
+ elif options.action == "lcov":
+ total = self.coverage.lcov_report(
+ outfile=options.outfile,
+ **report_args
+ )
+
else:
# There are no other possible actions.
raise AssertionError
@@ -854,6 +879,7 @@ HELP_TOPICS = {
report Report coverage stats on modules.
run Run a Python program and measure code execution.
xml Create an XML report of coverage results.
+ lcov Create an LCOV report of coverage results.
Use "{program_name} help <command>" for detailed help on any command.
""",