From 12a8de72c6507abeeea7e0e1b452cf57e738fba0 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Fri, 30 Aug 2019 10:54:58 +0100 Subject: [PATCH] test cov-fail-under float pass and fail --- tests/test_pytest_cov.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index 0b0da6d8..e745c956 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -349,11 +349,25 @@ def test_cov_min_float_value(testdir): result = testdir.runpytest('-v', '--cov=%s' % script.dirpath(), '--cov-report=term-missing', - '--cov-fail-under=51.03', + '--cov-fail-under=88.88', script) assert result.ret == 0 result.stdout.fnmatch_lines([ - 'Required test coverage of 51.03% reached. Total coverage: *%' + 'Required test coverage of 88.88% reached. Total coverage: 88.89%' + ]) + + +def test_cov_min_float_value_not_reached(testdir): + script = testdir.makepyfile(SCRIPT) + + result = testdir.runpytest('-v', + '--cov=%s' % script.dirpath(), + '--cov-report=term-missing', + '--cov-fail-under=88.89', + script) + assert result.ret == 1 + result.stdout.fnmatch_lines([ + 'FAIL Required test coverage of 88.89% not reached. Total coverage: 88.89%' ])