Commits

Ned Batchelder  committed b03faea

Omit and include are now filename patterns rather than prefixes. BACKWARD INCOMPATIBLE change.

  • Participants
  • Parent commits de5d2fc

Comments (0)

Files changed (18)

 Next version
 ------------
 
+- BACKWARD INCOMPATIBILITY: the --omit switch now takes file patterns rather
+  than file prefixes.
+  
+- BACKWARD INCOMPATIBILITY: the `omit_prefixes` argument is gone throughout
+  coverage.py, replaced with `omit`, a list of filename patterns suitable for
+  `fnmatch`.
+
 - The reporting commands (report, annotate, html, and xml) now have a --include
   switch to restrict reporting to modules beginning with those prefixes,
   similar to the existing --omit switch.  Thanks, Zooko.

File coverage/annotate.py

     blank_re = re.compile(r"\s*(#|$)")
     else_re = re.compile(r"\s*else\s*:\s*(#|$)")
 
-    def report(self, morfs, directory=None, omit_prefixes=None,
-                include_prefixes=None):
+    def report(self, morfs, directory=None, omit=None, include=None):
         """Run the report.
 
         See `coverage.report()` for arguments.
 
         """
-        self.report_files(
-            self.annotate_file, morfs, directory, omit_prefixes,
-            include_prefixes
-            )
+        self.report_files(self.annotate_file, morfs, directory, omit, include)
 
     def annotate_file(self, cu, analysis):
         """Annotate a single file.

File coverage/cmdline.py

         # 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(
             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:
             '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(
 
         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"""
 

File coverage/codeunit.py

 """Code unit (module) handling for Coverage."""
 
-import glob, os
+import fnmatch, glob, os
 
 from coverage.backward import string_class, StringIO
 from coverage.misc import CoverageException
 
 
-def code_unit_factory(
-    morfs, file_locator, omit_prefixes=None, include_prefixes=None
-    ):
+def code_unit_factory(morfs, file_locator, omit=None, include=None):
     """Construct a list of CodeUnits from polymorphic inputs.
 
     `morfs` is a module or a filename, or a list of same.
 
     `file_locator` is a FileLocator that can help resolve filenames.
 
-    `include_prefixes` is a list of prefixes. Only CodeUnits that match those
-    prefixes will be included in the list. `omit_prefixes` is a list of
-    prefixes to omit from the list.
+    `include` is a list of filename patterns. Only CodeUnits that match those
+    patterns will be included in the list. `omit` is a list of patterns to omit
+    from the list.
 
     Returns a list of CodeUnit objects.
 
 
     code_units = [CodeUnit(morf, file_locator) for morf in morfs]
 
-    if include_prefixes:
-        assert not isinstance(include_prefixes, string_class) # common mistake
-        prefixes = [file_locator.abs_file(p) for p in include_prefixes]
+    if include:
+        assert not isinstance(include, string_class) # common mistake
+        patterns = [file_locator.abs_file(p) for p in include]
         filtered = []
         for cu in code_units:
-            for prefix in prefixes:
-                if cu.filename.startswith(prefix):
+            for pattern in patterns:
+                if fnmatch.fnmatch(cu.filename, pattern):
                     filtered.append(cu)
                     break
         code_units = filtered
 
-    if omit_prefixes:
-        assert not isinstance(omit_prefixes, string_class) # common mistake
-        prefixes = [file_locator.abs_file(p) for p in omit_prefixes]
+    if omit:
+        assert not isinstance(omit, string_class) # common mistake
+        patterns = [file_locator.abs_file(p) for p in omit]
         filtered = []
         for cu in code_units:
-            for prefix in prefixes:
-                if cu.filename.startswith(prefix):
+            for pattern in patterns:
+                if fnmatch.fnmatch(cu.filename, pattern):
                     break
             else:
                 filtered.append(cu)

File coverage/config.py

         # Defaults for [report]
         self.exclude_list = ['(?i)# *pragma[: ]*no *cover']
         self.ignore_errors = False
-        self.omit_prefixes = None
-        self.include_prefixes = None
+        self.omit = None
+        self.include = None
 
         # Defaults for [html]
         self.html_dir = "htmlcov"
         if cp.has_option('run', 'timid'):
             self.timid = cp.getboolean('run', 'timid')
         if cp.has_option('run', 'omit'):
-            self.omit_prefixes = self.get_list(cp, 'run', 'omit')
+            self.omit = self.get_list(cp, 'run', 'omit')
         if cp.has_option('run', 'include'):
-            self.include_prefixes = self.get_list(cp, 'run', 'include')
+            self.include = self.get_list(cp, 'run', 'include')
 
         # [report]
         if cp.has_option('report', 'exclude_lines'):
         if cp.has_option('report', 'ignore_errors'):
             self.ignore_errors = cp.getboolean('report', 'ignore_errors')
         if cp.has_option('report', 'omit'):
-            self.omit_prefixes = self.get_list(cp, 'report', 'omit')
+            self.omit = self.get_list(cp, 'report', 'omit')
         if cp.has_option('report', 'include'):
-            self.include_prefixes = self.get_list(cp, 'report', 'include')
+            self.include = self.get_list(cp, 'report', 'include')
 
         # [html]
         if cp.has_option('html', 'directory'):

File coverage/control.py

 """Core control stuff for Coverage."""
 
-import atexit, os, random, socket, sys
+import atexit, fnmatch, os, random, socket, sys
 
 from coverage.annotate import AnnotateReporter
 from coverage.backward import string_class
 
     def __init__(self, data_file=None, data_suffix=None, cover_pylib=None,
                 auto_data=False, timid=None, branch=None, config_file=True,
-                omit_prefixes=None, include_prefixes=None):
+                omit=None, include=None):
         """
         `data_file` is the base name of the data file to use, defaulting to
         ".coverage".  `data_suffix` is appended (with a dot) to `data_file` to
         standard file is read (".coveragerc").  If it is False, then no file is
         read.
 
-        `omit_prefixes` and `include_prefixes` are lists of filename prefixes.
-        Files that match `include_prefixes` will be measured, files that match
-        `omit_prefixes` will not.
+        `include` and `omit` are lists of filename patterns. Files that match
+        `include` will be measured, files that match `omit` will not.
 
         """
         from coverage import __version__
         self.config.from_args(
             data_file=data_file, cover_pylib=cover_pylib, timid=timid,
             branch=branch, parallel=bool_or_none(data_suffix),
-            omit_prefixes=omit_prefixes,
-            include_prefixes=include_prefixes
+            omit=omit, include=include
             )
 
         self.auto_data = auto_data
 
         self.file_locator = FileLocator()
 
-        self.omit_prefixes = self._abs_files(self.config.omit_prefixes)
-        self.include_prefixes = self._abs_files(self.config.include_prefixes)
+        self.omit = self._abs_files(self.config.omit)
+        self.include = self._abs_files(self.config.include)
 
         self.collector = Collector(
             self._should_trace, timid=self.config.timid,
             return False
 
         # Check the file against the include and omit prefixes.
-        if self.include_prefixes:
-            for prefix in self.include_prefixes:
-                if canonical.startswith(prefix):
+        if self.include:
+            for pattern in self.include:
+                if fnmatch.fnmatch(canonical, pattern):
                     break
             else:
                 return False
-        for prefix in self.omit_prefixes:
-            if canonical.startswith(prefix):
+        for pattern in self.omit:
+            if fnmatch.fnmatch(canonical, pattern):
                 return False
 
         return canonical
 
     def report(self, morfs=None, show_missing=True, ignore_errors=None,
                 file=None,                          # pylint: disable-msg=W0622
-                omit_prefixes=None, include_prefixes=None
+                omit=None, include=None
                 ):
         """Write a summary report to `file`.
 
         Each module in `morfs` is listed, with counts of statements, executed
         statements, missing statements, and a list of lines missed.
 
-        `include_prefixes` is a list of filename prefixes.  Modules that match
-        those prefixes will be included in the report.  Modules that match
-        `omit_prefixes` will not be included in the report.
+        `include` is a list of filename patterns.  Modules whose filenames
+        match those patterns will be included in the report. Modules matching
+        `omit` will not be included in the report.
 
         """
         self.config.from_args(
-            ignore_errors=ignore_errors,
-            omit_prefixes=omit_prefixes,
-            include_prefixes=include_prefixes
+            ignore_errors=ignore_errors, omit=omit, include=include
             )
         reporter = SummaryReporter(
             self, show_missing, self.config.ignore_errors
             )
         reporter.report(
-            morfs, outfile=file, omit_prefixes=self.config.omit_prefixes,
-            include_prefixes=self.config.include_prefixes
+            morfs, outfile=file, omit=self.config.omit,
+            include=self.config.include
             )
 
     def annotate(self, morfs=None, directory=None, ignore_errors=None,
-                    omit_prefixes=None, include_prefixes=None):
+                    omit=None, include=None):
         """Annotate a list of modules.
 
         Each module in `morfs` is annotated.  The source is written to a new
 
         """
         self.config.from_args(
-            ignore_errors=ignore_errors,
-            omit_prefixes=omit_prefixes,
-            include_prefixes=include_prefixes
+            ignore_errors=ignore_errors, omit=omit, include=include
             )
         reporter = AnnotateReporter(self, self.config.ignore_errors)
         reporter.report(
             morfs, directory=directory,
-            omit_prefixes=self.config.omit_prefixes,
-            include_prefixes=self.config.include_prefixes
+            omit=self.config.omit,
+            include=self.config.include
             )
 
     def html_report(self, morfs=None, directory=None, ignore_errors=None,
-                    omit_prefixes=None, include_prefixes=None):
+                    omit=None, include=None):
         """Generate an HTML report.
 
         See `coverage.report()` for other arguments.
 
         """
         self.config.from_args(
-            ignore_errors=ignore_errors,
-            omit_prefixes=omit_prefixes,
-            include_prefixes=include_prefixes,
+            ignore_errors=ignore_errors, omit=omit, include=include,
             html_dir=directory,
             )
         reporter = HtmlReporter(self, self.config.ignore_errors)
         reporter.report(
             morfs, directory=self.config.html_dir,
-            omit_prefixes=self.config.omit_prefixes,
-            include_prefixes=self.config.include_prefixes
+            omit=self.config.omit,
+            include=self.config.include
             )
 
     def xml_report(self, morfs=None, outfile=None, ignore_errors=None,
-                    omit_prefixes=None, include_prefixes=None):
+                    omit=None, include=None):
         """Generate an XML report of coverage results.
 
         The report is compatible with Cobertura reports.
 
         """
         self.config.from_args(
-            ignore_errors=ignore_errors,
-            omit_prefixes=omit_prefixes,
-            include_prefixes=include_prefixes,
+            ignore_errors=ignore_errors, omit=omit, include=include,
             xml_output=outfile,
             )
         file_to_close = None
         try:
             reporter = XmlReporter(self, self.config.ignore_errors)
             reporter.report(
-                morfs, omit_prefixes=self.config.omit_prefixes,
-                include_prefixes=self.config.include_prefixes, outfile=outfile
+                morfs, omit=self.config.omit, include=self.config.include,
+                outfile=outfile
                 )
         finally:
             if file_to_close:

File coverage/html.py

         self.files = []
         self.arcs = coverage.data.has_arcs()
 
-    def report(self, morfs, directory, omit_prefixes=None,
-                include_prefixes=None
-                ):
+    def report(self, morfs, directory, omit=None, include=None):
         """Generate an HTML report for `morfs`.
 
         `morfs` is a list of modules or filenames.  `directory` is where to put
         assert directory, "must provide a directory for html reporting"
 
         # Process all the files.
-        self.report_files(
-            self.html_file, morfs, directory, omit_prefixes, include_prefixes
-            )
+        self.report_files(self.html_file, morfs, directory, omit, include)
 
         # Write the index file.
         self.index_file()

File coverage/report.py

         # classes.
         self.directory = None
 
-    def find_code_units(self, morfs, omit_prefixes, include_prefixes):
+    def find_code_units(self, morfs, omit, include):
         """Find the code units we'll report on.
 
-        `morfs` is a list of modules or filenames. `omit_prefixes` is a list
-        of prefixes to leave out of the list.
+        `morfs` is a list of modules or filenames.
 
         See `coverage.report()` for other arguments.
 
         """
         morfs = morfs or self.coverage.data.executed_files()
         self.code_units = code_unit_factory(
-                            morfs, self.coverage.file_locator, omit_prefixes,
-                            include_prefixes
+                            morfs, self.coverage.file_locator, omit, include
                             )
         self.code_units.sort()
 
     def report_files(self, report_fn, morfs, directory=None,
-                        omit_prefixes=None, include_prefixes=None):
+                        omit=None, include=None):
         """Run a reporting function on a number of morfs.
 
         `report_fn` is called for each relative morf in `morfs`.
 
-        `include_prefixes` is a list of filename prefixes. CodeUnits that match
-        those prefixes will be included in the list. CodeUnits that match
-        `omit_prefixes` will be omitted from the list.
+        `include` is a list of filename patterns. CodeUnits that match
+        those patterns will be included in the list. CodeUnits that match
+        `omit` will be omitted from the list.
 
         """
-        self.find_code_units(morfs, omit_prefixes, include_prefixes)
+        self.find_code_units(morfs, omit, include)
 
         if not self.code_units:
             raise CoverageException("No data to report.")

File coverage/summary.py

         self.show_missing = show_missing
         self.branches = coverage.data.has_arcs()
 
-    def report(self, morfs, omit_prefixes=None, outfile=None,
-                include_prefixes=None
-                ):
+    def report(self, morfs, omit=None, outfile=None, include=None):
         """Writes a report summarizing coverage statistics per module.
 
         See `coverage.report()` for other arguments.
 
         """
-        self.find_code_units(morfs, omit_prefixes, include_prefixes)
+        self.find_code_units(morfs, omit, include)
 
         # Prepare the formatting strings
         max_name = max([len(cu.name) for cu in self.code_units] + [5])

File coverage/xmlreport.py

         self.xml_out = None
         self.arcs = coverage.data.has_arcs()
 
-    def report(self, morfs, omit_prefixes=None, include_prefixes=None,
-                outfile=None
-                ):
+    def report(self, morfs, omit=None, include=None, outfile=None):
         """Generate a Cobertura-compatible XML report for `morfs`.
 
         `morfs` is a list of modules or filenames.
 
         # Call xml_file for each file in the data.
         self.packages = {}
-        self.report_files(
-            self.xml_file, morfs, omit_prefixes=omit_prefixes,
-            include_prefixes=include_prefixes
-            )
+        self.report_files(self.xml_file, morfs, omit=omit, include=include)
 
         lnum_tot, lhits_tot = 0, 0
         bnum_tot, bhits_tot = 0, 0

File test/farm/html/run_omit_2.py

     cov.start()
     import main
     cov.stop()
-    cov.html_report(directory="../html_omit_2", omit_prefixes=["m1"])
+    cov.html_report(directory="../html_omit_2", omit=["m1.py"])
 
 runfunc(html_it, rundir="src")
 compare("gold_omit_2", "html_omit_2", size_within=10, file_pattern="*.html")

File test/farm/html/run_omit_3.py

     cov.start()
     import main
     cov.stop()
-    cov.html_report(directory="../html_omit_3", omit_prefixes=["m1", "m2"])
+    cov.html_report(directory="../html_omit_3", omit=["m1.py", "m2.py"])
 
 runfunc(html_it, rundir="src")
 compare("gold_omit_3", "html_omit_3", size_within=10, file_pattern="*.html")

File test/farm/html/src/omit4.ini

 [report]
-omit = m2
+omit = m2.py

File test/farm/html/src/omit5.ini

 [report]
 omit =
     fooey
-    gooey, m2, kablooey
-    m3, helloworld
+    gooey, m[23]*, kablooey
+    helloworld
 
 [html]
 directory = ../html_omit_5

File test/test_api.py

         cov.report()
 
 class OmitIncludeTest(CoverageTest):
-    """Test using omit_prefixes and include_prefixes when measuring code."""
+    """Test using `omit` and `include` when measuring code."""
 
     def test_nothing_specified(self):
         self.make_file("a.py", """\
             b = 1
             """)
 
-        cov = coverage.coverage(include_prefixes=["a"])
+        cov = coverage.coverage(include=["a.py"])
         cov.start()
         self.import_module("b")
         cov.stop()
             b = 1
             """)
 
-        cov = coverage.coverage(omit_prefixes=["a"])
+        cov = coverage.coverage(omit=["a*"])
         cov.start()
         self.import_module("b")
         cov.stop()
             b = 1
             """)
 
-        cov = coverage.coverage(include_prefixes=["a"], omit_prefixes=["aa"])
+        cov = coverage.coverage(include=["a*"], omit=["aa.py"])  #TODO: use some patterns
         cov.start()
         self.import_module("ab")
         cov.stop()

File test/test_cmdline.py

     run_in_temp_dir = False
 
     INIT_LOAD = """\
-        .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include_prefixes=None, omit_prefixes=None)
+        .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include=None, omit=None)
         .load()\n"""
 
     def model_object(self):
     def testErase(self):
         # coverage -e
         self.cmd_executes("-e", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include_prefixes=None, omit_prefixes=None)
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include=None, omit=None)
             .erase()
             """)
         self.cmd_executes_same("-e", "--erase")
 
         # -x calls coverage.load first.
         self.cmd_executes("-x foo.py", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include_prefixes=None, omit_prefixes=None)
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include=None, omit=None)
             .load()
             .start()
             .run_python_file('foo.py', ['foo.py'])
             """)
         # -e -x calls coverage.erase first.
         self.cmd_executes("-e -x foo.py", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include_prefixes=None, omit_prefixes=None)
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include=None, omit=None)
             .erase()
             .start()
             .run_python_file('foo.py', ['foo.py'])
             """)
         # --timid sets a flag, and program arguments get passed through.
         self.cmd_executes("-x --timid foo.py abc 123", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=True, branch=None, config_file=True, include_prefixes=None, omit_prefixes=None)
+            .coverage(cover_pylib=None, data_suffix=None, timid=True, branch=None, config_file=True, include=None, omit=None)
             .load()
             .start()
             .run_python_file('foo.py', ['foo.py', 'abc', '123'])
             """)
         # -L sets a flag, and flags for the program don't confuse us.
         self.cmd_executes("-x -p -L foo.py -a -b", """\
-            .coverage(cover_pylib=True, data_suffix=True, timid=None, branch=None, config_file=True, include_prefixes=None, omit_prefixes=None)
+            .coverage(cover_pylib=True, data_suffix=True, timid=None, branch=None, config_file=True, include=None, omit=None)
             .load()
             .start()
             .run_python_file('foo.py', ['foo.py', '-a', '-b'])
     def testCombine(self):
         # coverage -c
         self.cmd_executes("-c", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include_prefixes=None, omit_prefixes=None)
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include=None, omit=None)
             .load()
             .combine()
             .save()
     def testReport(self):
         # coverage -r [-m] [-i] [-o DIR,...] [FILE1 FILE2 ...]
         self.cmd_executes("-r", self.INIT_LOAD + """\
-            .report(ignore_errors=None, omit_prefixes=None, include_prefixes=None, morfs=[],
+            .report(ignore_errors=None, omit=None, include=None, morfs=[],
                     show_missing=None)
             """)
         self.cmd_executes("-r -i", self.INIT_LOAD + """\
-            .report(ignore_errors=True, omit_prefixes=None, include_prefixes=None, morfs=[],
+            .report(ignore_errors=True, omit=None, include=None, morfs=[],
                     show_missing=None)
             """)
         self.cmd_executes("-r -m", self.INIT_LOAD + """\
-            .report(ignore_errors=None, omit_prefixes=None, include_prefixes=None, morfs=[],
+            .report(ignore_errors=None, omit=None, include=None, morfs=[],
                     show_missing=True)
             """)
         self.cmd_executes("-r -o fooey", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include_prefixes=None, omit_prefixes=["fooey"])
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include=None, omit=["fooey"])
             .load()
-            .report(ignore_errors=None, omit_prefixes=["fooey"], include_prefixes=None,
+            .report(ignore_errors=None, omit=["fooey"], include=None,
                     morfs=[], show_missing=None)
             """)
         self.cmd_executes("-r -o fooey,booey", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include_prefixes=None, omit_prefixes=["fooey", "booey"])
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include=None, omit=["fooey", "booey"])
             .load()
-            .report(ignore_errors=None, omit_prefixes=["fooey", "booey"], include_prefixes=None,
+            .report(ignore_errors=None, omit=["fooey", "booey"], include=None,
                     morfs=[], show_missing=None)
             """)
         self.cmd_executes("-r mod1", self.INIT_LOAD + """\
-            .report(ignore_errors=None, omit_prefixes=None, include_prefixes=None,
+            .report(ignore_errors=None, omit=None, include=None,
                     morfs=["mod1"], show_missing=None)
             """)
         self.cmd_executes("-r mod1 mod2 mod3", self.INIT_LOAD + """\
-            .report(ignore_errors=None, omit_prefixes=None, include_prefixes=None,
+            .report(ignore_errors=None, omit=None, include=None,
                     morfs=["mod1", "mod2", "mod3"], show_missing=None)
             """)
 
         # coverage -a [-d DIR] [-i] [-o DIR,...] [FILE1 FILE2 ...]
         self.cmd_executes("-a", self.INIT_LOAD + """\
             .annotate(directory=None, ignore_errors=None,
-                    omit_prefixes=None, include_prefixes=None, morfs=[])
+                    omit=None, include=None, morfs=[])
             """)
         self.cmd_executes("-a -d dir1", self.INIT_LOAD + """\
             .annotate(directory="dir1", ignore_errors=None,
-                    omit_prefixes=None, include_prefixes=None, morfs=[])
+                    omit=None, include=None, morfs=[])
             """)
         self.cmd_executes("-a -i", self.INIT_LOAD + """\
             .annotate(directory=None, ignore_errors=True,
-                    omit_prefixes=None, include_prefixes=None, morfs=[])
+                    omit=None, include=None, morfs=[])
             """)
         self.cmd_executes("-a -o fooey", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include_prefixes=None, omit_prefixes=["fooey"])
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include=None, omit=["fooey"])
             .load()
             .annotate(directory=None, ignore_errors=None,
-                    omit_prefixes=["fooey"], include_prefixes=None, morfs=[])
+                    omit=["fooey"], include=None, morfs=[])
             """)
         self.cmd_executes("-a -o fooey,booey", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include_prefixes=None, omit_prefixes=["fooey", "booey"])
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include=None, omit=["fooey", "booey"])
             .load()
             .annotate(directory=None, ignore_errors=None,
-                    omit_prefixes=["fooey", "booey"], include_prefixes=None, morfs=[])
+                    omit=["fooey", "booey"], include=None, morfs=[])
             """)
         self.cmd_executes("-a mod1", self.INIT_LOAD + """\
             .annotate(directory=None, ignore_errors=None,
-                    omit_prefixes=None, include_prefixes=None, morfs=["mod1"])
+                    omit=None, include=None, morfs=["mod1"])
             """)
         self.cmd_executes("-a mod1 mod2 mod3", self.INIT_LOAD + """\
             .annotate(directory=None, ignore_errors=None,
-                    omit_prefixes=None, include_prefixes=None, morfs=["mod1", "mod2", "mod3"])
+                    omit=None, include=None, morfs=["mod1", "mod2", "mod3"])
             """)
 
         self.cmd_executes_same("-a", "--annotate")
         # coverage -b -d DIR [-i] [-o DIR,...] [FILE1 FILE2 ...]
         self.cmd_executes("-b", self.INIT_LOAD + """\
             .html_report(directory=None, ignore_errors=None,
-                    omit_prefixes=None, include_prefixes=None, morfs=[])
+                    omit=None, include=None, morfs=[])
             """)
         self.cmd_executes("-b -d dir1", self.INIT_LOAD + """\
             .html_report(directory="dir1", ignore_errors=None,
-                    omit_prefixes=None, include_prefixes=None, morfs=[])
+                    omit=None, include=None, morfs=[])
             """)
         self.cmd_executes("-b -i", self.INIT_LOAD + """\
             .html_report(directory=None, ignore_errors=True,
-                    omit_prefixes=None, include_prefixes=None, morfs=[])
+                    omit=None, include=None, morfs=[])
             """)
         self.cmd_executes("-b -o fooey", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include_prefixes=None, omit_prefixes=["fooey"])
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include=None, omit=["fooey"])
             .load()
             .html_report(directory=None, ignore_errors=None,
-                    omit_prefixes=["fooey"], include_prefixes=None, morfs=[])
+                    omit=["fooey"], include=None, morfs=[])
             """)
         self.cmd_executes("-b -o fooey,booey", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include_prefixes=None, omit_prefixes=["fooey", "booey"])
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include=None, omit=["fooey", "booey"])
             .load()
             .html_report(directory=None, ignore_errors=None,
-                    omit_prefixes=["fooey", "booey"], include_prefixes=None, morfs=[])
+                    omit=["fooey", "booey"], include=None, morfs=[])
             """)
         self.cmd_executes("-b mod1", self.INIT_LOAD + """\
             .html_report(directory=None, ignore_errors=None,
-                    omit_prefixes=None, include_prefixes=None, morfs=["mod1"])
+                    omit=None, include=None, morfs=["mod1"])
             """)
         self.cmd_executes("-b mod1 mod2 mod3", self.INIT_LOAD + """\
             .html_report(directory=None, ignore_errors=None,
-                    omit_prefixes=None, include_prefixes=None, morfs=["mod1", "mod2", "mod3"])
+                    omit=None, include=None, morfs=["mod1", "mod2", "mod3"])
             """)
 
         self.cmd_executes_same("-b", "--html")
         self.cmd_executes_same("run --timid f.py", "-e -x --timid f.py")
         self.cmd_executes_same("run", "-x")
         self.cmd_executes("run --branch foo.py", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=True, config_file=True, include_prefixes=None, omit_prefixes=None)
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=True, config_file=True, include=None, omit=None)
             .erase()
             .start()
             .run_python_file('foo.py', ['foo.py'])
             .save()
             """)
         self.cmd_executes("run --rcfile=myrc.rc foo.py", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file="myrc.rc", include_prefixes=None, omit_prefixes=None)
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file="myrc.rc", include=None, omit=None)
             .erase()
             .start()
             .run_python_file('foo.py', ['foo.py'])
             .save()
             """)
         self.cmd_executes("run --include=pre1,pre2 foo.py", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include_prefixes=["pre1", "pre2"], omit_prefixes=None)
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include=["pre1", "pre2"], omit=None)
             .erase()
             .start()
             .run_python_file('foo.py', ['foo.py'])
             .save()
             """)
         self.cmd_executes("run --omit=opre1,opre2 foo.py", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include_prefixes=None, omit_prefixes=["opre1", "opre2"])
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include=None, omit=["opre1", "opre2"])
             .erase()
             .start()
             .run_python_file('foo.py', ['foo.py'])
             """\
             .coverage(cover_pylib=None, data_suffix=None, timid=None,
                 branch=None, config_file=True,
-                include_prefixes=["pre1", "pre2"],
-                omit_prefixes=["opre1", "opre2"])
+                include=["pre1", "pre2"],
+                omit=["opre1", "opre2"])
             .erase()
             .start()
             .run_python_file('foo.py', ['foo.py'])
     def testXml(self):
         # coverage xml [-i] [--omit DIR,...] [FILE1 FILE2 ...]
         self.cmd_executes("xml", self.INIT_LOAD + """\
-            .xml_report(ignore_errors=None, omit_prefixes=None, include_prefixes=None, morfs=[],
+            .xml_report(ignore_errors=None, omit=None, include=None, morfs=[],
                     outfile="coverage.xml")
             """)
         self.cmd_executes("xml -i", self.INIT_LOAD + """\
-            .xml_report(ignore_errors=True, omit_prefixes=None, include_prefixes=None, morfs=[],
+            .xml_report(ignore_errors=True, omit=None, include=None, morfs=[],
                     outfile="coverage.xml")
             """)
         self.cmd_executes("xml -o myxml.foo", self.INIT_LOAD + """\
-            .xml_report(ignore_errors=None, omit_prefixes=None, include_prefixes=None, morfs=[],
+            .xml_report(ignore_errors=None, omit=None, include=None, morfs=[],
                     outfile="myxml.foo")
             """)
         self.cmd_executes("xml -o -", self.INIT_LOAD + """\
-            .xml_report(ignore_errors=None, omit_prefixes=None, include_prefixes=None, morfs=[],
+            .xml_report(ignore_errors=None, omit=None, include=None, morfs=[],
                     outfile="-")
             """)
         self.cmd_executes("xml --omit fooey", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include_prefixes=None, omit_prefixes=["fooey"])
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include=None, omit=["fooey"])
             .load()
-            .xml_report(ignore_errors=None, omit_prefixes=["fooey"], include_prefixes=None, morfs=[],
+            .xml_report(ignore_errors=None, omit=["fooey"], include=None, morfs=[],
                     outfile="coverage.xml")
             """)
         self.cmd_executes("xml --omit fooey,booey", """\
-            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include_prefixes=None, omit_prefixes=["fooey", "booey"])
+            .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, include=None, omit=["fooey", "booey"])
             .load()
-            .xml_report(ignore_errors=None, omit_prefixes=["fooey", "booey"], include_prefixes=None,
+            .xml_report(ignore_errors=None, omit=["fooey", "booey"], include=None,
                     morfs=[], outfile="coverage.xml")
             """)
         self.cmd_executes("xml mod1", self.INIT_LOAD + """\
-            .xml_report(ignore_errors=None, omit_prefixes=None, include_prefixes=None, morfs=["mod1"],
+            .xml_report(ignore_errors=None, omit=None, include=None, morfs=["mod1"],
                     outfile="coverage.xml")
             """)
         self.cmd_executes("xml mod1 mod2 mod3", self.INIT_LOAD + """\
-            .xml_report(ignore_errors=None, omit_prefixes=None, include_prefixes=None,
+            .xml_report(ignore_errors=None, omit=None, include=None,
                     morfs=["mod1", "mod2", "mod3"], outfile="coverage.xml")
             """)
 

File test/test_config.py

             ["if 0:", "pragma:?\s+no cover", "another_tab"]
             )
         self.assertTrue(cov.config.ignore_errors)
-        self.assertEqual(cov.config.include_prefixes, ["a/", "b/"])
-        self.assertEqual(cov.config.omit_prefixes,
+        self.assertEqual(cov.config.include, ["a/", "b/"])
+        self.assertEqual(cov.config.omit,
             ["one", "another", "some_more", "yet_more"]
             )
 

File test/test_summary.py

         # Try reporting while omitting some modules
         prefix = os.path.split(__file__)[0]
         self.run_command("coverage -x mycode.py")
-        report = self.report_from_command("coverage -r -o %s" % prefix)
+        report = self.report_from_command("coverage -r -o '%s/*'" % prefix)
 
         # Name     Stmts   Miss  Cover
         # ----------------------------