Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent undesirable new lines to be displayed when report is disabled #540

Merged
merged 1 commit into from
Jul 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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