summaryrefslogtreecommitdiff
path: root/tests/test_lcov.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2022-12-31 20:10:18 -0500
committerNed Batchelder <ned@nedbatchelder.com>2022-12-31 20:39:09 -0500
commit3760b9876cc837f7d5d22fbadf6a0da51eb9cec5 (patch)
treee0e43663b1ad5448c295e3961bf017f5800e3915 /tests/test_lcov.py
parent586726322069bab62f33dccab70101ca76f595c2 (diff)
downloadpython-coveragepy-git-3760b9876cc837f7d5d22fbadf6a0da51eb9cec5.tar.gz
fix: lcov command didn't report a total, so --fail-under didn't work
Diffstat (limited to 'tests/test_lcov.py')
-rw-r--r--tests/test_lcov.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/test_lcov.py b/tests/test_lcov.py
index ed7706fb..6c9605ca 100644
--- a/tests/test_lcov.py
+++ b/tests/test_lcov.py
@@ -3,6 +3,7 @@
"""Test LCOV-based summary reporting for coverage.py."""
+import math
import textwrap
from tests.coveragetest import CoverageTest
@@ -75,7 +76,8 @@ class LcovTest(CoverageTest):
self.assert_doesnt_exist(".coverage")
cov = coverage.Coverage(source=["."])
self.start_import_stop(cov, "main_file")
- cov.lcov_report()
+ pct = cov.lcov_report()
+ assert pct == 50.0
actual_result = self.get_lcov_report_content()
assert expected_result == actual_result
@@ -87,7 +89,8 @@ class LcovTest(CoverageTest):
self.make_file(".coveragerc", "[lcov]\noutput = data.lcov\n")
cov = coverage.Coverage(source=".")
self.start_import_stop(cov, "test_file")
- cov.lcov_report()
+ pct = cov.lcov_report()
+ assert pct == 50.0
self.assert_exists("data.lcov")
expected_result = textwrap.dedent("""\
TN:
@@ -130,7 +133,8 @@ class LcovTest(CoverageTest):
self.assert_doesnt_exist(".coverage")
cov = coverage.Coverage(branch=True, source=".")
self.start_import_stop(cov, "main_file")
- cov.lcov_report()
+ pct = cov.lcov_report()
+ assert math.isclose(pct, 16.666666666666668)
self.assert_exists("coverage.lcov")
expected_result = textwrap.dedent("""\
TN:
@@ -177,7 +181,8 @@ class LcovTest(CoverageTest):
self.assert_doesnt_exist(".coverage")
cov = coverage.Coverage(branch=True, source=".")
self.start_import_stop(cov, "test_file")
- cov.lcov_report()
+ pct = cov.lcov_report()
+ assert math.isclose(pct, 41.666666666666664)
self.assert_exists("coverage.lcov")
expected_result = textwrap.dedent("""\
TN:
@@ -225,7 +230,8 @@ class LcovTest(CoverageTest):
self.assert_doesnt_exist(".coverage")
cov = coverage.Coverage(branch=True, source=".")
self.start_import_stop(cov, "main_file")
- cov.lcov_report()
+ pct = cov.lcov_report()
+ assert math.isclose(pct, 66.66666666666667)
self.assert_exists("coverage.lcov")
expected_result = textwrap.dedent("""\
TN:
@@ -259,7 +265,8 @@ class LcovTest(CoverageTest):
self.assert_doesnt_exist(".coverage")
cov = coverage.Coverage(branch=True, source=".")
self.start_import_stop(cov, "__init__")
- cov.lcov_report()
+ pct = cov.lcov_report()
+ assert pct == 0.0
self.assert_exists("coverage.lcov")
# Newer Pythons have truly empty empty files.
if env.PYBEHAVIOR.empty_is_empty: