def compute_jacoco_test_statistic(project_coverage_report): """Compute test coverage etc. from the CSV data exported from JaCoCo and converted.""" java_classes = project_coverage_report.read_java_classes() statements, missed, coverage = ProjectCoverageReport.compute_total(java_classes) log_coverage(statements, missed, coverage) return {"statements": statements, "missed": missed, "coverage": int(coverage), "progress_bar_class": progress_bar_class(coverage), "progress_bar_width": progress_bar_width(coverage)}
def compute_jacoco_test_statistic(project_coverage_report): """Compute test coverage etc. from the CSV data exported from JaCoCo and converted.""" java_classes = project_coverage_report.read_java_classes() statements, missed, coverage = ProjectCoverageReport.compute_total( java_classes) log_coverage(statements, missed, coverage) return { "statements": statements, "missed": missed, "coverage": int(coverage), "progress_bar_class": progress_bar_class(coverage), "progress_bar_width": progress_bar_width(coverage) }
def parse_unit_test_statistic(line): """Parse the line containing unit test coverage statistic.""" pattern = re.compile(r'TOTAL\s+(\d+)\s+(\d+)\s+(\d+)%') match = pattern.match(line) if len(match.groups()) == 3: coverage = match.group(3) statements = match.group(1) missed = match.group(2) log_coverage(statements, missed, coverage) return {"statements": statements, "missed": missed, "coverage": coverage, "progress_bar_class": progress_bar_class(coverage), "progress_bar_width": progress_bar_width(coverage)} else: return None
def parse_unit_test_statistic(line): """Parse the line containing unit test coverage statistic.""" pattern = re.compile(r'TOTAL\s+(\d+)\s+(\d+)\s+(\d+)%') match = pattern.match(line) if len(match.groups()) == 3: coverage = match.group(3) statements = match.group(1) missed = match.group(2) log_coverage(statements, missed, coverage) return { "statements": statements, "missed": missed, "coverage": coverage, "progress_bar_class": progress_bar_class(coverage), "progress_bar_width": progress_bar_width(coverage) } else: return None
def parse_linter_results(filename): """Parse results generated by Python linter or by PyDocStyle.""" source = None files = {} passed = 0 failed = 0 total = 0 with open(filename) as fin: for line in fin: line = line.rstrip() if line.endswith(".py"): source = line.strip() if line.endswith(" Pass"): if source: passed += 1 total += 1 files[source] = True if line.endswith(" Fail"): if source: failed += 1 total += 1 files[source] = False display_results = bool(files) return { "display_results": display_results, "files": files, "total": total, "passed": passed, "failed": failed, "passed%": percentage(failed, passed), "failed%": percentage(passed, failed), "progress_bar_class": progress_bar_class(percentage(failed, passed)), "progress_bar_width": progress_bar_width(percentage(failed, passed)) }