1. Julian Berman
  2. coverage.py

Commits

Ned Batchelder  committed 310adba Merge

Merged

  • Participants
  • Parent commits 496dc67, b6c13fd
  • Branches default

Comments (0)

Files changed (6)

File .treerc

View file
     sample_html
     *.so *.pyd
     *.zip
+    _build

File CHANGES.txt

View file
 - Running coverage under a debugger is unlikely to work, but it shouldn't fail
   with "TypeError: 'NoneType' object is not iterable".  Fixes `issue 201`_.
 
+- Docstrings for the legacy singleton methods are more helpful.  Thanks Marius
+  Gedminas.  Closes `issue 205`_.
+
 .. _issue 193: https://bitbucket.org/ned/coveragepy/issue/193/unicodedecodeerror-on-htmlpy
 .. _issue 201: https://bitbucket.org/ned/coveragepy/issue/201/coverage-using-django-14-with-pydb-on
+.. _issue 205: https://bitbucket.org/ned/coveragepy/issue/205/make-pydoc-coverage-more-friendly
 
 
 Version 3.5.3 --- 29 September 2012

File coverage/__init__.py

View file
         if not _the_coverage:
             _the_coverage = coverage(auto_data=True)
         return getattr(_the_coverage, name)(*args, **kwargs)
+
+    import inspect
+    meth = getattr(coverage, name)
+    args, varargs, kw, defaults = inspect.getargspec(meth)
+    argspec = inspect.formatargspec(args[1:], varargs, kw, defaults)
+    docstring = meth.__doc__
+    wrapper.__doc__ = ("""\
+        A first-use-singleton wrapper around coverage.%(name)s.
+
+        This wrapper is provided for backward compatibility with legacy code.
+        New code should use coverage.%(name)s directly.
+
+        %(name)s%(argspec)s:
+
+        %(docstring)s
+        """ % locals()
+        )
+
     return wrapper
 
 

File igor.py

View file
 def do_check_eol(args):
     """Check files for incorrect newlines and trailing whitespace."""
 
-    ignore_dirs = ['.svn', '.hg', '.tox']
+    ignore_dirs = ['.svn', '.hg', '.tox', '.tox_kits']
     checked = set([])
 
     def check_file(fname, crlf=True, trail_white=True):

File test/coveragetest.py

View file
     run_in_temp_dir = True
 
     def setUp(self):
+        super(CoverageTest, self).setUp()
+
         # Tell newer unittest implementations to print long helpful messages.
         self.longMessage = True
 
         self.old_modules = dict(sys.modules)
 
     def tearDown(self):
+        super(CoverageTest, self).tearDown()
+
         # Restore the original sys.path.
         sys.path = self.old_syspath
 

File test/test_api.py

View file
         cov.report()
 
 
-class SourceOmitIncludeTest(CoverageTest):
-    """Test using `source`, `omit` and `include` when measuring code."""
+class UsingModulesMixin(object):
+    """A mixin for importing modules from test/modules and test/moremodules."""
 
     run_in_temp_dir = False
 
     def setUp(self):
-        super(SourceOmitIncludeTest, self).setUp()
+        super(UsingModulesMixin, self).setUp()
         # Parent class saves and restores sys.path, we can just modify it.
         self.old_dir = os.getcwd()
         os.chdir(self.nice_file(os.path.dirname(__file__), 'modules'))
 
     def tearDown(self):
         os.chdir(self.old_dir)
-        super(SourceOmitIncludeTest, self).tearDown()
+        super(UsingModulesMixin, self).tearDown()
+
+
+class SourceOmitIncludeTest(UsingModulesMixin, CoverageTest):
+    """Test using `source`, `omit` and `include` when measuring code."""
 
     def coverage_usepkgs_summary(self, **kwargs):
         """Run coverage on usepkgs and return the line summary.