Skip to content

Commit

Permalink
fix: use --precision argument when checking --fail-under (#1317)
Browse files Browse the repository at this point in the history
* 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 <ned@nedbatchelder.com>
  • Loading branch information
Kludex and nedbat committed Feb 2, 2022
1 parent aad5ece commit 73bb553
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions coverage/cmdline.py
Expand Up @@ -731,6 +731,8 @@ def command_line(self, argv):
# value, so we can get fail_under from the config file.
if options.fail_under is not None:
self.coverage.set_option("report:fail_under", options.fail_under)
if options.precision is not None:
self.coverage.set_option("report:precision", options.precision)

fail_under = self.coverage.get_option("report:fail_under")
precision = self.coverage.get_option("report:precision")
Expand Down
3 changes: 3 additions & 0 deletions tests/test_cmdline.py
Expand Up @@ -1136,6 +1136,9 @@ def lcov_report(self, *args_unused, **kwargs_unused):
((20, 30, 40, 50, 60), 61, "lcov", 2),
# Command-line overrides configuration.
((20, 30, 40, 50, 60), 19, "report --fail-under=21", 2),
# Precision defined
((20, 30, 40, 50, 60), None, "report --fail-under=20.1 --precision=1", 2),
((20, 30, 40, 50, 60), None, "report --fail-under=19.9 --precision=1", 0),
])
def test_fail_under(results, fail_under, cmd, ret):
cov = CoverageReportingFake(*results)
Expand Down

0 comments on commit 73bb553

Please sign in to comment.