summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-03-13 08:00:24 -0400
committerNed Batchelder <ned@nedbatchelder.com>2009-03-13 08:00:24 -0400
commit858721a9d5a3618b80d10ec71c6c2c32a89b6a7c (patch)
tree421805abbc8eca9412be61c295813f67bedb9f9c
parent67a7f3e65aab32763a2b3df2295c5c698ce001f0 (diff)
downloadpython-coveragepy-git-858721a9d5a3618b80d10ec71c6c2c32a89b6a7c.tar.gz
No need for coverage.analysis to return the filename, it's a property on the CodeUnit passed in.
-rw-r--r--coverage/annotate.py4
-rw-r--r--coverage/control.py19
-rw-r--r--coverage/summary.py2
3 files changed, 13 insertions, 12 deletions
diff --git a/coverage/annotate.py b/coverage/annotate.py
index c4fe810f..7cf48aa2 100644
--- a/coverage/annotate.py
+++ b/coverage/annotate.py
@@ -19,8 +19,8 @@ class AnnotateReporter(Reporter):
self.directory = directory
for cu in self.code_units:
try:
- filename, statements, excluded, missing, _ = self.coverage.analyze(cu)
- self.annotate_file(filename, statements, excluded, missing)
+ statements, excluded, missing, _ = self.coverage.analyze(cu)
+ self.annotate_file(cu.filename, statements, excluded, missing)
except KeyboardInterrupt:
raise
except:
diff --git a/coverage/control.py b/coverage/control.py
index 240a75f3..db9b0a6d 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -100,16 +100,18 @@ class coverage:
return f, s, m, mf
def analysis2(self, morf):
- code_units = code_unit_factory(morf, self.file_locator)
- return self.analyze(code_units[0])
+ code_unit = code_unit_factory(morf, self.file_locator)[0]
+ st, ex, m, mf = self.analyze(code_unit)
+ return code_unit.filename, st, ex, m, mf
def analyze(self, code_unit):
"""Analyze a single code unit.
- Otherwise, return a tuple of (1) the canonical filename of the source
- code for the module, (2) a list of lines of statements in the source
- code, (3) a list of lines of excluded statements, (4) a list of lines
- missing from execution, and (5), a readable string of missing lines.
+ Returns a tuple of:
+ - a list of lines of statements in the source code,
+ - a list of lines of excluded statements,
+ - a list of lines missing from execution, and
+ - a readable string of missing lines.
"""
from coverage.parser import CodeParser
@@ -149,9 +151,8 @@ class coverage:
else:
if line not in execed:
missing.append(line)
-
- return (filename, statements, excluded, missing,
- format_lines(statements, missing))
+
+ return (statements, excluded, missing, format_lines(statements, missing))
def report(self, morfs, show_missing=True, ignore_errors=False, file=None):
"""Write a summary report to `file`.
diff --git a/coverage/summary.py b/coverage/summary.py
index 779cdad0..275075d9 100644
--- a/coverage/summary.py
+++ b/coverage/summary.py
@@ -41,7 +41,7 @@ class SummaryReporter(Reporter):
for cu in self.code_units:
try:
- _, statements, _, missing, readable = self.coverage.analyze(cu)
+ statements, _, missing, readable = self.coverage.analyze(cu)
n = len(statements)
m = n - len(missing)
if n > 0: