2
Test our code coverage.
7
from twisted.trial import unittest, reporter
10
from quotient.benchmarks import coverage
12
class CoverageTest(unittest.TestCase):
13
def benchmarkCoverage(self):
15
t = unittest.TestSuite()
16
t.addPackage("quotient.test")
17
t.run(reporter.MinimalReporter(sys.stdout))
19
exclude = ['test', 'benchmarks']
22
for path, subdirs, filenames in os.walk(os.path.dirname(os.path.abspath(quotient.__file__))):
23
if os.path.basename(path) not in exclude:
26
module = os.path.join(path, f)
27
fname, statements, uncovered, _ = coverage.analysis(module)
28
totLines += len(statements)
29
uncoveredLines += len(uncovered)
31
pctCovered = (1.0 - (uncoveredLines/float(totLines))) * 100
32
self.recordStat({'testCoverage': (pctCovered, "percentage covered")})