diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2014-06-03 21:41:12 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2014-06-03 21:41:12 -0400 |
commit | d2d3a2929204cf9edc76ff911c05e25c5799b226 (patch) | |
tree | 5915f59e375d345aa04a209df07138fc082afe28 /coverage/cmdline.py | |
parent | 0bf1034464ffa4c8c18c025f943bc59b485a334c (diff) | |
download | python-coveragepy-d2d3a2929204cf9edc76ff911c05e25c5799b226.tar.gz |
Round fail-under result same as others. Fixed #284.
Diffstat (limited to 'coverage/cmdline.py')
-rw-r--r-- | coverage/cmdline.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py index 9a67b43..bd10d5a 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: |