Commits

Ned Batchelder committed e400c0c

Add some docstrings

Comments (0)

Files changed (5)

coverage/runners/__init__.py

+"""Coverage.py support for test runners."""

coverage/runners/noseplugin.py

 import logging
 from nose.plugins import Plugin
 
-from coverage.runners.plugin import CoverageTestWrapper
-from coverage.runners.plugin import options as coverage_opts
+from coverage.runners.plugin import CoverageTestWrapper, OPTIONS
 
 
 log = logging.getLogger("nose.plugins.coverage")
         """Add command-line options."""
 
         super(Coverage, self).options(parser, env)
-        for opt in coverage_opts:
+        for opt in OPTIONS:
             parser.add_option(opt)
 
     def configure(self, options, config):

coverage/runners/plugin.py

     3) Run your tests
     4) Call finish()
     5) Improve your code coverage ;)
+
     """
 
     coverPackages = None
         self.coverPackages = options.cover_package
 
     def start(self):
+        """Start coverage before the test suite."""
         # cover_omit is a ',' separated list if provided
         self.omit = pattern_list(self.options.cover_omit)
         self.include = pattern_list(self.options.cover_omit)
         self.coverage.start()
 
     def finish(self, stream=None):
+        """Finish coverage after the test suite."""
         self.coverage.stop()
         self.coverage.save()
 
         return
 
     def _want_module(self, name, module):
+        """Determine if this module should be reported on."""
         for package in self.coverPackages:
             if module is not None and name.startswith(package):
                 return True
         return False
 
 
-options = [
+# The command-line options for the plugin.
+OPTIONS = [
     optparse.Option('--cover-rcfile', action='store', metavar="RCFILE",
                     help="Specify configuration file.  ['.coveragerc']",
                     default=True),

coverage/runners/pytestplugin.py

 """py.test plugin hooks"""
 
-from coverage.runners.plugin import CoverageTestWrapper, options
+from coverage.runners.plugin import CoverageTestWrapper, OPTIONS
 
 def pytest_addoption(parser):
     """Get all the options from the coverage.runner and import them."""
     group = parser.getgroup('Coverage options')
-    for opt in options:
+    for opt in OPTIONS:
         group._addoption_instance(opt)
 
 def pytest_configure(config):

test/test_testplugin.py

+"""Tests of the test-runner plugins."""
+
 import py
 import unittest
 from nose.plugins import PluginTester
 from coverage.runners.noseplugin import Coverage
 
 class TestCoverage(PluginTester, unittest.TestCase):
+    """Test the nose plugin."""
+
     activate = '--with-coverage' # enables the plugin
     plugins = [Coverage()]
     args = ['--cover-report=report']
 
 pytest_plugins = ['pytester']
 def test_functional(testdir):
+    """Test the py.test plugin."""
+
     testdir.makepyfile("""
         def f():
             x = 42