diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-05-31 19:37:53 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-05-31 19:37:53 -0400 |
commit | 1157999dc5c6c3aa3129a7cd4bf249fe73598501 (patch) | |
tree | cba407bacb180fb8fcb46a1b5eaf7da2e0fd88fb /tests/test_process.py | |
parent | 65d9e0edbca0dc893ca70fbf64969e2ddc5a3680 (diff) | |
download | python-coveragepy-git-1157999dc5c6c3aa3129a7cd4bf249fe73598501.tar.gz |
fix: --fail-under=100 could report 100 is less than 100.
Use the same rounding rules for the fail-under message that are used for totals
everywhere else, so that it won't say:
total of 100 is less than fail-under=100
Diffstat (limited to 'tests/test_process.py')
-rw-r--r-- | tests/test_process.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_process.py b/tests/test_process.py index 9c695b2a..04a8a2d5 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -1249,6 +1249,22 @@ class FailUnderTest(CoverageTest): expected = "Coverage failure: total of 42.86 is less than fail-under=42.88" assert expected == self.last_line_squeezed(out) + def test_report_99p9_is_not_ok(self): + # A file with 99.99% coverage: + self.make_file("ninety_nine_plus.py", """\ + a = 1 + """ + """ + b = 2 + """ * 20000 + """ + if a > 3: + c = 4 + """) + self.run_command("coverage run --source=. ninety_nine_plus.py") + st, out = self.run_command_status("coverage report --fail-under=100") + assert st == 2 + expected = "Coverage failure: total of 99 is less than fail-under=100" + assert expected == self.last_line_squeezed(out) + class FailUnderNoFilesTest(CoverageTest): """Test that nothing to report results in an error exit status.""" |