From 0aba31552443d38e1f4bb2adab757b5f926c5048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 5 Oct 2019 12:33:51 +0300 Subject: [PATCH] Fix regression described in #348 - not all reports returning the total. --- src/pytest_cov/engine.py | 4 ++-- tests/test_pytest_cov.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pytest_cov/engine.py b/src/pytest_cov/engine.py index 93a0050e..322648b3 100644 --- a/src/pytest_cov/engine.py +++ b/src/pytest_cov/engine.py @@ -155,14 +155,14 @@ def summary(self, stream): if 'html' in self.cov_report: output = self.cov_report['html'] with _backup(self.cov, "config"): - self.cov.html_report(ignore_errors=True, directory=output) + total = self.cov.html_report(ignore_errors=True, directory=output) stream.write('Coverage HTML written to dir %s\n' % (self.cov.config.html_dir if output is None else output)) # Produce xml report if wanted. if 'xml' in self.cov_report: output = self.cov_report['xml'] with _backup(self.cov, "config"): - self.cov.xml_report(ignore_errors=True, outfile=output) + total = self.cov.xml_report(ignore_errors=True, outfile=output) stream.write('Coverage XML written to file %s\n' % (self.cov.config.xml_output if output is None else output)) return total diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index adc28d54..e79e9aab 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -396,7 +396,8 @@ def test_cov_min_50(testdir): result = testdir.runpytest('-v', '--cov=%s' % script.dirpath(), - '--cov-report=term-missing', + '--cov-report=html', + '--cov-report=xml', '--cov-fail-under=50', script)