1. Álvaro Justen - Turicas
  2. coverage.py


Ned Batchelder  committed e400c0c

Add some docstrings

  • Participants
  • Parent commits f20b567
  • Branches default

Comments (0)

Files changed (5)

File coverage/runners/__init__.py

View file
  • Ignore whitespace
+"""Coverage.py support for test runners."""

File coverage/runners/noseplugin.py

View file
  • Ignore whitespace
 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:
     def configure(self, options, config):

File coverage/runners/plugin.py

View file
  • Ignore whitespace
     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)
     def finish(self, stream=None):
+        """Finish coverage after the test suite."""
     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.
     optparse.Option('--cover-rcfile', action='store', metavar="RCFILE",
                     help="Specify configuration file.  ['.coveragerc']",

File coverage/runners/pytestplugin.py

View file
  • Ignore whitespace
 """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:
 def pytest_configure(config):

File test/test_testplugin.py

View file
  • Ignore whitespace
+"""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."""
         def f():
             x = 42