summaryrefslogtreecommitdiff
path: root/CoverageTestRunner.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2008-07-19 20:07:03 +0300
committerLars Wirzenius <liw@liw.fi>2008-07-19 20:07:03 +0300
commitdb20e026375c90d9cefd1224f3c40b8389b41c56 (patch)
tree4f32efada52e117c6593de57f4f3e24620b4dc21 /CoverageTestRunner.py
parent37c3ddda90d48ddf793d78873bd681177f345d4a (diff)
downloadpython-coverage-test-runner-db20e026375c90d9cefd1224f3c40b8389b41c56.tar.gz
Report number of excluded statements in the output.
Diffstat (limited to 'CoverageTestRunner.py')
-rw-r--r--CoverageTestRunner.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/CoverageTestRunner.py b/CoverageTestRunner.py
index 5bbcb59..c81fa70 100644
--- a/CoverageTestRunner.py
+++ b/CoverageTestRunner.py
@@ -32,6 +32,7 @@ class CoverageTestResult(unittest.TestResult):
self.total = total
self.lastmsg = ""
self.coverage_missed = []
+ self.coverage_excluded = []
self.timings = []
def addCoverageMissed(self, filename, statements, missed_statements,
@@ -39,6 +40,9 @@ class CoverageTestResult(unittest.TestResult):
self.coverage_missed.append((filename, statements, missed_statements,
missed_description))
+ def addCoverageExcluded(self, statements):
+ self.coverage_excluded += statements
+
def wasSuccessful(self, ignore_coverage=False):
return (unittest.TestResult.wasSuccessful(self) and
(ignore_coverage or not self.coverage_missed))
@@ -145,11 +149,15 @@ class CoverageTestRunner:
del sys.path[0]
suite.run(result)
coverage.stop()
- filename, stmts, missed, missed_desc = coverage.analysis(module)
+ filename, stmts, excluded, missed, missed_desc = \
+ coverage.analysis2(module)
+ if self._dirname and filename.startswith(self._dirname):
+ filename = filename[len(self._dirname):]
if missed:
- if self._dirname and filename.startswith(self._dirname):
- filename = filename[len(self._dirname):]
result.addCoverageMissed(filename, stmts, missed, missed_desc)
+ print "xxxx"
+ print "excluded:", excluded
+ result.addCoverageExcluded(excluded)
end_time = time.time()
@@ -177,6 +185,9 @@ class CoverageTestRunner:
print "%d failures, %d errors" % (len(result.failures),
len(result.errors))
+ if result.coverage_excluded:
+ print len(result.coverage_excluded), "excluded statements"
+
if end_time - start_time > 10:
print
print "Slowest tests:"