Skip to content

Commit

Permalink
Prevent undesirable new lines to be displayed when report is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Delgan authored and ionelmc committed Jul 22, 2022
1 parent 60b73ec commit 218419f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pytest_cov/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,11 @@ def pytest_terminal_summary(self, terminalreporter):
# we shouldn't report, or report generation failed (error raised above)
return

terminalreporter.write('\n' + self.cov_report.getvalue() + '\n')
report = self.cov_report.getvalue()

# Avoid undesirable new lines when output is disabled with "--cov-report=".
if report:
terminalreporter.write('\n' + report + '\n')

if self.options.cov_fail_under is not None and self.options.cov_fail_under > 0:
failed = self.cov_total < self.options.cov_fail_under
Expand Down

0 comments on commit 218419f

Please sign in to comment.