Skip to content

Commit 218419f

Browse files
Delganionelmc
authored andcommitted
Prevent undesirable new lines to be displayed when report is disabled
1 parent 60b73ec commit 218419f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/pytest_cov/plugin.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,11 @@ def pytest_terminal_summary(self, terminalreporter):
326326
# we shouldn't report, or report generation failed (error raised above)
327327
return
328328

329-
terminalreporter.write('\n' + self.cov_report.getvalue() + '\n')
329+
report = self.cov_report.getvalue()
330+
331+
# Avoid undesirable new lines when output is disabled with "--cov-report=".
332+
if report:
333+
terminalreporter.write('\n' + report + '\n')
330334

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

0 commit comments

Comments
 (0)