diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2010-05-29 23:51:53 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2010-05-29 23:51:53 -0400 |
commit | ec6b5187461bfe701e0741c35375a0e341c07e78 (patch) | |
tree | ba7d374837ce77cc9c6cd2102e355a9afb0654a2 /coverage/cmdline.py | |
parent | 366d15ff4949f6f13ccae5e800248a6b624a9ee2 (diff) | |
parent | b5990d4ceb60c3028575a11f8d7fd4080411ed67 (diff) | |
download | python-coveragepy-git-ec6b5187461bfe701e0741c35375a0e341c07e78.tar.gz |
Merge latest code from main coverage.py repo
Diffstat (limited to 'coverage/cmdline.py')
-rw-r--r-- | coverage/cmdline.py | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py index cb47690c..a0184af8 100644 --- a/coverage/cmdline.py +++ b/coverage/cmdline.py @@ -34,9 +34,9 @@ class Opts(object): ) include = optparse.Option( '', '--include', action='store', - metavar="PRE1,PRE2,...", - help="Include files only when their filename path starts with one of " - "these prefixes." + metavar="PAT1,PAT2,...", + help="Include files only when their filename path matches one of " + "these patterns. Usually needs quoting on the command line." ) pylib = optparse.Option( '-L', '--pylib', action='store_true', @@ -50,15 +50,15 @@ class Opts(object): ) old_omit = optparse.Option( '-o', '--omit', action='store', - metavar="PRE1,PRE2,...", - help="Omit files when their filename path starts with one of these " - "prefixes." + metavar="PAT1,PAT2,...", + help="Omit files when their filename matches one of these patterns. " + "Usually needs quoting on the command line." ) omit = optparse.Option( '', '--omit', action='store', - metavar="PRE1,PRE2,...", - help="Omit files when their filename path starts with one of these " - "prefixes." + metavar="PAT1,PAT2,...", + help="Omit files when their filename matches one of these patterns. " + "Usually needs quoting on the command line." ) output_xml = optparse.Option( '-o', '', action='store', dest="outfile", @@ -442,10 +442,10 @@ class CoverageScript(object): # Listify the list options. omit = None if options.omit: - omit = options.omit.split(',') + omit = self.pattern_list(options.omit) include = None if options.include: - include = options.include.split(',') + include = self.pattern_list(options.include) # Do something. self.coverage = self.covpkg.coverage( @@ -454,8 +454,8 @@ class CoverageScript(object): timid = options.timid, branch = options.branch, config_file = options.rcfile, - omit_prefixes = omit, - include_prefixes = include, + omit = omit, + include = include, ) if 'debug' in options.actions: @@ -514,8 +514,8 @@ class CoverageScript(object): 'ignore_errors': options.ignore_errors, } - report_args['omit_prefixes'] = omit - report_args['include_prefixes'] = include + report_args['omit'] = omit + report_args['include'] = include if 'report' in options.actions: self.coverage.report( @@ -532,6 +532,17 @@ class CoverageScript(object): return OK + def pattern_list(self, s): + """Turn an argument into a list of patterns.""" + if sys.platform == 'win32': + # When running coverage as coverage.exe, some of the behavior + # of the shell is emulated: wildcards are expanded into a list of + # filenames. So you have to single-quote patterns on the command + # line, but (not) helpfully, the single quotes are included in the + # argument, so we have to strip them off here. + s = s.strip("'") + return s.split(',') + HELP_TOPICS = r""" |