File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -56,16 +56,23 @@ def validate_report(arg):
56
56
57
57
def validate_fail_under (num_str ):
58
58
try :
59
- return int (num_str )
59
+ value = int (num_str )
60
60
except ValueError :
61
- return float (num_str )
61
+ try :
62
+ value = float (num_str )
63
+ except ValueError :
64
+ raise argparse .ArgumentTypeError ('An integer or float value is required.' )
65
+ if value > 100 :
66
+ raise argparse .ArgumentTypeError ('Your desire for over-achievement is admirable but misplaced. '
67
+ 'The maximum value is 100. Perhaps write more integration tests?' )
68
+ return value
62
69
63
70
64
71
def validate_context (arg ):
65
72
if coverage .version_info <= (5 , 0 ):
66
73
raise argparse .ArgumentTypeError ('Contexts are only supported with coverage.py >= 5.x' )
67
74
if arg != "test" :
68
- raise argparse .ArgumentTypeError ('--cov-context=test is the only supported value' )
75
+ raise argparse .ArgumentTypeError ('The only supported value is "test". ' )
69
76
return arg
70
77
71
78
You can’t perform that action at this time.
0 commit comments