Skip to content

Commit

Permalink
Merge pull request #977 from navyad/navyad/fail-under
Browse files Browse the repository at this point in the history
message for fail-under
  • Loading branch information
nedbat committed Jun 28, 2020
2 parents e5bdc22 + d17e263 commit 8458b41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions coverage/cmdline.py
Expand Up @@ -629,6 +629,7 @@ def command_line(self, argv):
fail_under = self.coverage.get_option("report:fail_under")
precision = self.coverage.get_option("report:precision")
if should_fail_under(total, fail_under, precision):
print("fail-under has failed")
return FAIL_UNDER

return OK
Expand Down
4 changes: 2 additions & 2 deletions tests/test_process.py
Expand Up @@ -1236,13 +1236,13 @@ def test_report_43_is_ok(self):
def test_report_43_is_not_ok(self):
st, out = self.run_command_status("coverage report --fail-under=44")
self.assertEqual(st, 2)
self.assertEqual(self.last_line_squeezed(out), "forty_two_plus.py 7 4 43%")
self.assertEqual(self.last_line_squeezed(out), "fail-under has failed")

def test_report_42p86_is_not_ok(self):
self.make_file(".coveragerc", "[report]\nprecision = 2")
st, out = self.run_command_status("coverage report --fail-under=42.88")
self.assertEqual(st, 2)
self.assertEqual(self.last_line_squeezed(out), "forty_two_plus.py 7 4 42.86%")
self.assertEqual(self.last_line_squeezed(out), "fail-under has failed")


class FailUnderNoFilesTest(CoverageTest):
Expand Down

0 comments on commit 8458b41

Please sign in to comment.