Skip to content

Commit 73bb553

Browse files
Kludexnedbat
andauthored
fix: use --precision argument when checking --fail-under (#1317)
* build: windows 3.11.0a4 started failing to save the pip cache * Fix precision argument when using cmd * Remove print * Remove isort things * last isort... Co-authored-by: Ned Batchelder <[email protected]>
1 parent aad5ece commit 73bb553

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

coverage/cmdline.py

+2
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,8 @@ def command_line(self, argv):
731731
# value, so we can get fail_under from the config file.
732732
if options.fail_under is not None:
733733
self.coverage.set_option("report:fail_under", options.fail_under)
734+
if options.precision is not None:
735+
self.coverage.set_option("report:precision", options.precision)
734736

735737
fail_under = self.coverage.get_option("report:fail_under")
736738
precision = self.coverage.get_option("report:precision")

tests/test_cmdline.py

+3
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,9 @@ def lcov_report(self, *args_unused, **kwargs_unused):
11361136
((20, 30, 40, 50, 60), 61, "lcov", 2),
11371137
# Command-line overrides configuration.
11381138
((20, 30, 40, 50, 60), 19, "report --fail-under=21", 2),
1139+
# Precision defined
1140+
((20, 30, 40, 50, 60), None, "report --fail-under=20.1 --precision=1", 2),
1141+
((20, 30, 40, 50, 60), None, "report --fail-under=19.9 --precision=1", 0),
11391142
])
11401143
def test_fail_under(results, fail_under, cmd, ret):
11411144
cov = CoverageReportingFake(*results)

0 commit comments

Comments
 (0)