From dfe2fa5e5db2cf29a1b43b0abf61be3b545db270 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 3 Jun 2014 21:41:12 -0400 Subject: Round fail-under result same as others. Fixed #284. --- coverage/cmdline.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'coverage/cmdline.py') diff --git a/coverage/cmdline.py b/coverage/cmdline.py index 9a67b436..bd10d5a8 100644 --- a/coverage/cmdline.py +++ b/coverage/cmdline.py @@ -470,6 +470,14 @@ class CoverageScript(object): total = self.coverage.xml_report(outfile=outfile, **report_args) if options.fail_under is not None: + # Total needs to be rounded, but be careful of 0 and 100. + if 0 < total < 1: + total = 1 + elif 99 < total < 100: + total = 99 + else: + total = round(total) + if total >= options.fail_under: return OK else: -- cgit v1.2.1