File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -629,7 +629,10 @@ def command_line(self, argv):
629
629
fail_under = self .coverage .get_option ("report:fail_under" )
630
630
precision = self .coverage .get_option ("report:precision" )
631
631
if should_fail_under (total , fail_under , precision ):
632
- print ("fail-under has failed" )
632
+ msg = "total of {total:.{p}f} is less than fail-under={fail_under:.{p}f}" .format (
633
+ total = total , fail_under = fail_under , p = precision ,
634
+ )
635
+ print ("Coverage failure:" , msg )
633
636
return FAIL_UNDER
634
637
635
638
return OK
Original file line number Diff line number Diff line change @@ -1236,13 +1236,19 @@ def test_report_43_is_ok(self):
1236
1236
def test_report_43_is_not_ok (self ):
1237
1237
st , out = self .run_command_status ("coverage report --fail-under=44" )
1238
1238
self .assertEqual (st , 2 )
1239
- self .assertEqual (self .last_line_squeezed (out ), "fail-under has failed" )
1239
+ self .assertEqual (
1240
+ self .last_line_squeezed (out ),
1241
+ "Coverage failure: total of 43 is less than fail-under=44"
1242
+ )
1240
1243
1241
1244
def test_report_42p86_is_not_ok (self ):
1242
1245
self .make_file (".coveragerc" , "[report]\n precision = 2" )
1243
1246
st , out = self .run_command_status ("coverage report --fail-under=42.88" )
1244
1247
self .assertEqual (st , 2 )
1245
- self .assertEqual (self .last_line_squeezed (out ), "fail-under has failed" )
1248
+ self .assertEqual (
1249
+ self .last_line_squeezed (out ),
1250
+ "Coverage failure: total of 42.86 is less than fail-under=42.88"
1251
+ )
1246
1252
1247
1253
1248
1254
class FailUnderNoFilesTest (CoverageTest ):
You can’t perform that action at this time.
0 commit comments