summaryrefslogtreecommitdiff
path: root/coverage/cmdline.py
diff options
context:
space:
mode:
authorÉric Larivière <elarivie@users.noreply.github.com>2021-01-30 17:55:11 -0500
committerGitHub <noreply@github.com>2021-01-30 17:55:11 -0500
commita0f6692f5cc9344ae790300dcc0cf743ac9abbd3 (patch)
tree9884b4de9221850ffe5a10f919322d2ffeabdcef /coverage/cmdline.py
parent0143891b04c0c800fe1a508ab424cbe825f4210b (diff)
downloadpython-coveragepy-git-a0f6692f5cc9344ae790300dcc0cf743ac9abbd3.tar.gz
Add combine --keep (#1110)
* Add combine --keep Related to https://github.com/nedbat/coveragepy/issues/1108 * Fix unit tests * Fix line too long * Fix line too long
Diffstat (limited to 'coverage/cmdline.py')
-rw-r--r--coverage/cmdline.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py
index 9c9ae868..11bc5d99 100644
--- a/coverage/cmdline.py
+++ b/coverage/cmdline.py
@@ -31,6 +31,10 @@ class Opts(object):
'-a', '--append', action='store_true',
help="Append coverage data to .coverage, otherwise it starts clean each time.",
)
+ keep = optparse.make_option(
+ '', '--keep', action='store_true',
+ help="Keep combined coverage files, otherwise they are deleted.",
+ )
branch = optparse.make_option(
'', '--branch', action='store_true',
help="Measure branch coverage in addition to statement coverage.",
@@ -215,6 +219,7 @@ class CoverageOptionParser(optparse.OptionParser, object):
help=None,
ignore_errors=None,
include=None,
+ keep=None,
module=None,
omit=None,
contexts=None,
@@ -333,6 +338,7 @@ CMDS = {
"combine",
[
Opts.append,
+ Opts.keep,
] + GLOBAL_ARGS,
usage="[options] <path1> <path2> ... <pathN>",
description=(
@@ -585,7 +591,7 @@ class CoverageScript(object):
if options.append:
self.coverage.load()
data_dirs = args or None
- self.coverage.combine(data_dirs, strict=True)
+ self.coverage.combine(data_dirs, strict=True, keep=bool(options.keep))
self.coverage.save()
return OK