summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO.txt9
-rw-r--r--coverage/annotate.py22
-rw-r--r--test/farm/annotate/gold/white.py,cover2
-rw-r--r--test/farm/annotate/gold_v24/white.py,cover2
-rw-r--r--test/farm/annotate/src/white.py2
5 files changed, 33 insertions, 4 deletions
diff --git a/TODO.txt b/TODO.txt
index 1acf2dd..0275d9c 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -124,13 +124,13 @@ x Tricky swapping of collector like figleaf, pycov, et al. (Don't need to do
- More classes:
- Module munging
+ Coverage data files
-- Why are some imports at the top of the file, and some in functions?
++ Why are some imports at the top of the file, and some in functions?
+ Get rid of sys.exitfunc use.
+ True and False (with no backward adaptation: the constants are new in 2.2.1)
+ Get rid of compiler module
+ In analyzing code
+ In test_coverage.py
-- Style:
++ Style:
+ lineno
+ filename
@@ -146,14 +146,14 @@ x Tricky swapping of collector like figleaf, pycov, et al. (Don't need to do
+ Test both the C trace function and the Python trace function.
- Tests about the .coverage file.
- Tests about the --long-form of arguments.
-- Tests about overriding the .coverage filename.
++ Tests about overriding the .coverage filename.
- Tests about parallel mode.
+ Tests about assigning a multi-line string.
- Tests about tricky docstrings.
- Coverage test Coverage!
- Tests that tracing stops after calling stop()
- More intensive thread testing.
-- Tests about the "import __main__" in cmdline.py
+x Tests about the "import __main__" in cmdline.py
- What happens if the -x script raises an exception?
@@ -166,6 +166,7 @@ x Tricky swapping of collector like figleaf, pycov, et al. (Don't need to do
- Pythons 2.3, 2.4, 2.5, 2.6
- Version number in coverage/__init__.py:__version__
- Update CHANGES, including release date.
+- Update docs
- Kits:
- source .tgz
- windows .exe for each Python
diff --git a/coverage/annotate.py b/coverage/annotate.py
index ece6333..3cbe240 100644
--- a/coverage/annotate.py
+++ b/coverage/annotate.py
@@ -5,6 +5,27 @@ import os, re
from coverage.report import Reporter
class AnnotateReporter(Reporter):
+ """Generate annotated source files showing line coverage.
+
+ This reporter creates annotated copies of the measured source files. Each
+ .py file is copied as a .py,cover file, with a left-hand margin annotating
+ each line::
+
+ > def h(x):
+ - if 0: #pragma: no cover
+ - pass
+ > if x == 1:
+ ! a = 1
+ > else:
+ > a = 2
+
+ > h(2)
+
+ Executed lines use '>', lines not executed use '!', lines excluded from
+ consideration use '-'.
+
+ """
+
def __init__(self, coverage, ignore_errors=False):
super(AnnotateReporter, self).__init__(coverage, ignore_errors)
self.directory = None
@@ -13,6 +34,7 @@ class AnnotateReporter(Reporter):
else_re = re.compile(r"\s*else\s*:\s*(#|$)")
def report(self, morfs, directory=None, omit_prefixes=None):
+ """Run the report."""
self.report_files(self.annotate_file, morfs, directory, omit_prefixes)
def annotate_file(self, cu, statements, excluded, missing):
diff --git a/test/farm/annotate/gold/white.py,cover b/test/farm/annotate/gold/white.py,cover
index a959ed5..0287ea9 100644
--- a/test/farm/annotate/gold/white.py,cover
+++ b/test/farm/annotate/gold/white.py,cover
@@ -23,6 +23,8 @@
> g(1)
> def h(x):
+- if 0: #pragma: no cover
+- pass
> if x == 1:
! a = 1
> else:
diff --git a/test/farm/annotate/gold_v24/white.py,cover b/test/farm/annotate/gold_v24/white.py,cover
index 952222c..3eca578 100644
--- a/test/farm/annotate/gold_v24/white.py,cover
+++ b/test/farm/annotate/gold_v24/white.py,cover
@@ -23,6 +23,8 @@
> g(1)
> def h(x):
+- if 0: #pragma: no cover
+- pass
> if x == 1:
! a = 1
> else:
diff --git a/test/farm/annotate/src/white.py b/test/farm/annotate/src/white.py
index 0c4bcb8..ecbbd25 100644
--- a/test/farm/annotate/src/white.py
+++ b/test/farm/annotate/src/white.py
@@ -23,6 +23,8 @@ def g(x):
g(1)
def h(x):
+ if 0: #pragma: no cover
+ pass
if x == 1:
a = 1
else: