summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2012-10-27 17:12:16 -0400
committerNed Batchelder <ned@nedbatchelder.com>2012-10-27 17:12:16 -0400
commited69ae75ac040c6dbc5921d21f8966c517beb1c0 (patch)
treef1875d6c7d9e863ac55f557dad903247d3f367e4
parent3f19d512f0e72fbc055c488f7344a27267fd0876 (diff)
parentacb2a6f32ca12db086b5f8e0510965d8d563e551 (diff)
downloadpython-coveragepy-git-ed69ae75ac040c6dbc5921d21f8966c517beb1c0.tar.gz
Merged
-rw-r--r--.treerc1
-rw-r--r--CHANGES.txt4
-rw-r--r--coverage/__init__.py18
-rw-r--r--igor.py2
-rw-r--r--test/coveragetest.py4
-rw-r--r--test/test_api.py12
6 files changed, 36 insertions, 5 deletions
diff --git a/.treerc b/.treerc
index 30c9b719..a17ee3cb 100644
--- a/.treerc
+++ b/.treerc
@@ -10,3 +10,4 @@ ignore =
sample_html
*.so *.pyd
*.zip
+ _build
diff --git a/CHANGES.txt b/CHANGES.txt
index 80312068..57a7df29 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -12,8 +12,12 @@ Version 3.5.4b1
- 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
diff --git a/coverage/__init__.py b/coverage/__init__.py
index 637bc7ab..e2db3a56 100644
--- a/coverage/__init__.py
+++ b/coverage/__init__.py
@@ -42,6 +42,24 @@ def _singleton_method(name):
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
diff --git a/igor.py b/igor.py
index b144573b..e596f873 100644
--- a/igor.py
+++ b/igor.py
@@ -55,7 +55,7 @@ def do_zip_mods(args):
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):
diff --git a/test/coveragetest.py b/test/coveragetest.py
index 627635f1..61a75197 100644
--- a/test/coveragetest.py
+++ b/test/coveragetest.py
@@ -32,6 +32,8 @@ class CoverageTest(TestCase):
run_in_temp_dir = True
def setUp(self):
+ super(CoverageTest, self).setUp()
+
# Tell newer unittest implementations to print long helpful messages.
self.longMessage = True
@@ -71,6 +73,8 @@ class CoverageTest(TestCase):
self.old_modules = dict(sys.modules)
def tearDown(self):
+ super(CoverageTest, self).tearDown()
+
# Restore the original sys.path.
sys.path = self.old_syspath
diff --git a/test/test_api.py b/test/test_api.py
index 5dc9621d..8f270098 100644
--- a/test/test_api.py
+++ b/test/test_api.py
@@ -342,13 +342,13 @@ class ApiTest(CoverageTest):
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'))
@@ -357,7 +357,11 @@ class SourceOmitIncludeTest(CoverageTest):
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.