summaryrefslogtreecommitdiff
path: root/coverage/annotate.py
diff options
context:
space:
mode:
authorNed Batchelder <nedbat@gmail.com>2015-04-24 21:06:26 -0400
committerNed Batchelder <nedbat@gmail.com>2015-04-24 21:06:26 -0400
commit4cac18d36cd53c85f43ab79816b71cd2d4a3e6db (patch)
tree5741c738325d92c1a417b2c943f9b3f98f3417ba /coverage/annotate.py
parent3d88444cd3659fb93f17cbf4288c23bc82f33ead (diff)
parentc3a98ff12933710d751ec28b984edb7936d457d3 (diff)
downloadpython-coveragepy-4cac18d36cd53c85f43ab79816b71cd2d4a3e6db.tar.gz
Merged in lep/coverage.py (pull request #48)
Fix #363: crash when annotating non-ascii characters in python 2.
Diffstat (limited to 'coverage/annotate.py')
-rw-r--r--coverage/annotate.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/coverage/annotate.py b/coverage/annotate.py
index d4bbeb3..6e68d4a 100644
--- a/coverage/annotate.py
+++ b/coverage/annotate.py
@@ -42,10 +42,10 @@ class AnnotateReporter(Reporter):
"""
self.report_files(self.annotate_file, morfs, directory)
- def annotate_file(self, cu, analysis):
+ def annotate_file(self, fr, analysis):
"""Annotate a single file.
- `cu` is the CodeUnit for the file to annotate.
+ `fr` is the FileReporter for the file to annotate.
"""
statements = sorted(analysis.statements)
@@ -53,18 +53,18 @@ class AnnotateReporter(Reporter):
excluded = sorted(analysis.excluded)
if self.directory:
- dest_file = os.path.join(self.directory, cu.flat_rootname())
+ dest_file = os.path.join(self.directory, fr.flat_rootname())
if dest_file.endswith("_py"):
dest_file = dest_file[:-3] + ".py"
dest_file += ",cover"
else:
- dest_file = cu.filename + ",cover"
+ dest_file = fr.filename + ",cover"
with open(dest_file, 'w') as dest:
i = 0
j = 0
covered = True
- source = cu.source()
+ source = fr.source()
for lineno, line in enumerate(source.splitlines(True), start=1):
while i < len(statements) and statements[i] < lineno:
i += 1