diff options
Diffstat (limited to 'test-chill/testchill/gcov.py')
-rw-r--r-- | test-chill/testchill/gcov.py | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/test-chill/testchill/gcov.py b/test-chill/testchill/gcov.py index c989151..668c00e 100644 --- a/test-chill/testchill/gcov.py +++ b/test-chill/testchill/gcov.py @@ -3,7 +3,6 @@ import functools import itertools import os import os.path -import pickle import sys from . import util @@ -187,13 +186,13 @@ class GcovSet(object): cov = self.coverage_by_program[prog_name] cov.merge(Gcov.parse(cov.srcdir, process_name)) - def unexecuted_lines(self): - covlist = sorted(self.coverage_by_program.values(), key=lambda c: c.srcdir) - for src, grp in itertools.groupby(covlist, lambda c: c.srcdir): - files = functools.reduce(lambda a, c: a | c, grp).files.values() - file_lines = iter((f.src_file_name, iter(l for l in f.lines if l.count() == 0)) for f in files) - yield src, file_lines - + #def unexecuted_lines(self): + # covlist = sorted(self.coverage_by_program.values(), key=lambda c: c.srcdir) + # for src, grp in itertools.groupby(covlist, lambda c: c.srcdir): + # files = functools.reduce(lambda a, c: a | c, grp).files.values() + # file_lines = iter((f.src_file_name, iter(l for l in f.lines if l.count() == 0)) for f in files) + # yield src, file_lines + # #def pretty_print(self, outfile=sys.stdout, width=60, stats=['unexecuted', 'unexecuted.bysrc']): # print('='*width, file=outfile) # print(' CODE COVERAGE', file=outfile) @@ -216,26 +215,10 @@ class GcovSet(object): def _get_coverage_by_file(self): return functools.reduce(lambda a,b: a|b, self.coverage_by_program.values()).files + def _get_filenames(self): + return self.coverage_by_file.keys() + coverage_by_file = property(_get_coverage_by_file) - - -def load(filename = 'coverage.pickle'): - with open(filename) as f: - return pickle.load(f) - - -def lines(covset, filename, predicate=None): - if predicate is None: - predicate = lambda l: True - for line in filter(predicate, covset.coverage_by_file[filename].lines): - yield line.lineno, line.count(), line.code - - -def nonexecuted(covset, filename): - return lines(covset, filename, lambda line: line.count() == 0) - - -def commented(covset, filename): - return lines(covset, filename, lambda line: line.count() is None) + filenames = property(_get_filenames) |