From 74eb4cc8b684269b89735e31b623f0f9795c5d5c Mon Sep 17 00:00:00 2001 From: Jonathan Stewmon Date: Mon, 27 Mar 2023 11:26:00 -0500 Subject: [PATCH 1/2] perf: only call summary when the report will be used --- src/pytest_cov/plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pytest_cov/plugin.py b/src/pytest_cov/plugin.py index dd7b8c4e..59af4b17 100644 --- a/src/pytest_cov/plugin.py +++ b/src/pytest_cov/plugin.py @@ -275,7 +275,8 @@ def pytest_testnodedown(self, node, error): self.cov_controller.testnodedown(node, error) def _should_report(self): - return not (self.failed and self.options.no_cov_on_fail) + needed = self.options.cov_report or self.options.cov_fail_under + return needed and not (self.failed and self.options.no_cov_on_fail) def _failed_cov_total(self): cov_fail_under = self.options.cov_fail_under From 88a7d348986bace58e26c88a713ef35f900ce2ef Mon Sep 17 00:00:00 2001 From: Jonathan Stewmon Date: Mon, 27 Mar 2023 13:03:12 -0500 Subject: [PATCH 2/2] chore: update AUTHORS and CHANGELOG --- AUTHORS.rst | 1 + CHANGELOG.rst | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 2ad80a00..22ae71f5 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -57,3 +57,4 @@ Authors * Colin O'Dell - https://github.com/colinodell * Ronny Pfannschmidt - https://github.com/RonnyPfannschmidt * Christian Fetzer - https://github.com/fetzerch +* Jonathan Stewmon = https://github.com/jstewmon diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c49683f5..efeaf34c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,13 @@ Changelog ========= +4.0.1 (2023-03-27) +------------------ + +* Skip generating the in-memory coverage report when it will not be used. For example, + when ``--cov-report=''`` is used without ``--cov-fail-under``. + + 4.0.0 (2022-09-28) ------------------