diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2022-11-06 12:17:11 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2022-11-06 13:33:53 -0500 |
commit | e5a15c1d5652574ba85673f814b09f5da333fca8 (patch) | |
tree | 889dc8497bfb1817f91d8322f74ba35db5efceb2 /tests/test_summary.py | |
parent | 30f1ecf0657fa89b56eab300f10c58852edbbcdd (diff) | |
download | python-coveragepy-git-e5a15c1d5652574ba85673f814b09f5da333fca8.tar.gz |
feat: --format=total writes just the total number
Diffstat (limited to 'tests/test_summary.py')
-rw-r--r-- | tests/test_summary.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/test_summary.py b/tests/test_summary.py index 3a14ee3c..e32a1d2e 100644 --- a/tests/test_summary.py +++ b/tests/test_summary.py @@ -439,6 +439,9 @@ class SummaryTest(UsingModulesMixin, CoverageTest): squeezed = self.squeezed_lines(report) assert squeezed[4] == "1 file skipped due to complete coverage." + total = self.get_report(cov, output_format="total", skip_covered=True) + assert total == "100\n" + def test_report_skip_covered_longfilename(self): self.make_file("long_______________filename.py", """ def foo(): @@ -829,7 +832,7 @@ class SummaryTest(UsingModulesMixin, CoverageTest): cov = coverage.Coverage(source=["."]) self.start_import_stop(cov, "mymissing") assert self.stdout() == 'y\nz\n' - report = self.get_report(cov,squeeze=False, output_format="markdown", show_missing=True) + report = self.get_report(cov, squeeze=False, output_format="markdown", show_missing=True) # | Name | Stmts | Miss | Cover | Missing | # |------------- | -------: | -------: | ------: | --------: | @@ -840,6 +843,11 @@ class SummaryTest(UsingModulesMixin, CoverageTest): assert report_lines[2] == "| mymissing.py | 14 | 3 | 79% | 3-4, 10 |" assert report_lines[3] == "| **TOTAL** | **14** | **3** | **79%** | |" + assert self.get_report(cov, output_format="total") == "79\n" + assert self.get_report(cov, output_format="total", precision=2) == "78.57\n" + assert self.get_report(cov, output_format="total", precision=4) == "78.5714\n" + + class ReportingReturnValueTest(CoverageTest): """Tests of reporting functions returning values.""" |