Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def fail_under(covdata, threshold_line, threshold_branch):
(lines_total, lines_covered, percent,
branches_total, branches_covered,
percent_branches) = get_global_stats(covdata)
if branches_total == 0:
percent_branches = 100.0
if percent < threshold_line and percent_branches < threshold_branch:
sys.exit(6)
if percent < threshold_line:
sys.exit(2)
if percent_branches < threshold_branch:
sys.exit(4)
def print_summary(covdata):
'''Print a small report to the standard output.
Output the percentage, covered and total lines and branches.
'''
(lines_total, lines_covered, percent,
branches_total, branches_covered,
percent_branches) = get_global_stats(covdata)
lines_out = "lines: %0.1f%% (%s out of %s)\n" % (
percent, lines_covered, lines_total
)
branches_out = "branches: %0.1f%% (%s out of %s)\n" % (
percent_branches, branches_covered, branches_total
)
sys.stdout.write(lines_out)
sys.stdout.write(branches_out)