diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2010-06-13 21:46:35 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2010-06-13 21:46:35 -0400 |
commit | cf7fa58279cf644c47864485260a7139d9608b2d (patch) | |
tree | b568ddf59350961a2c4e137a4321ce12093d685e /coverage/cmdline.py | |
parent | f198d9d2c0df551ce79d97eb448a62f8bdb0cf26 (diff) | |
download | python-coveragepy-git-cf7fa58279cf644c47864485260a7139d9608b2d.tar.gz |
The 'source' option is a list of directories or packages to limit coverage's attention.
Diffstat (limited to 'coverage/cmdline.py')
-rw-r--r-- | coverage/cmdline.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py index d8738db7..8bf90e21 100644 --- a/coverage/cmdline.py +++ b/coverage/cmdline.py @@ -75,6 +75,10 @@ class Opts(object): '', '--rcfile', action='store', help="Specify configuration file. Defaults to '.coveragerc'" ) + source = optparse.Option( + '', '--source', action='store', metavar="SRC1,SRC2,...", + help="A list of packages or directories of code to be measured." + ) timid = optparse.Option( '', '--timid', action='store_true', help="Use a simpler but slower trace method. Try this if you get " @@ -110,6 +114,7 @@ class CoverageOptionParser(optparse.OptionParser, object): pylib=None, rcfile=True, show_missing=None, + source=None, timid=None, erase_first=None, version=None, @@ -290,6 +295,7 @@ CMDS = { Opts.pylib, Opts.parallel_mode, Opts.timid, + Opts.source, Opts.omit, Opts.include, ] + GLOBAL_ARGS, @@ -440,8 +446,9 @@ class CoverageScript(object): return ERR # Listify the list options. - omit = pattern_list(options.omit) - include = pattern_list(options.include) + source = unshell_list(options.source) + omit = unshell_list(options.omit) + include = unshell_list(options.include) # Do something. self.coverage = self.covpkg.coverage( @@ -450,6 +457,7 @@ class CoverageScript(object): timid = options.timid, branch = options.branch, config_file = options.rcfile, + source = source, omit = omit, include = include, ) @@ -528,8 +536,8 @@ class CoverageScript(object): return OK -def pattern_list(s): - """Turn an argument into a list of patterns.""" +def unshell_list(s): + """Turn a command-line argument into a list.""" if not s: return None if sys.platform == 'win32': |