Skip to content

Commit f974cb1

Browse files
committed
Refactor pytest_terminal_summary
1 parent 1aa7dbd commit f974cb1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/pytest_mypy/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,15 +391,17 @@ def pytest_terminal_summary(
391391
except FileNotFoundError:
392392
# No MypyItems executed.
393393
return
394-
if config.option.mypy_xfail or results.unmatched_stdout or results.stderr:
395-
terminalreporter.section(terminal_summary_title)
394+
if not results.stdout and not results.stderr:
395+
return
396+
terminalreporter.section(terminal_summary_title)
397+
if results.stdout:
396398
if config.option.mypy_xfail:
397399
terminalreporter.write(results.stdout)
398400
elif results.unmatched_stdout:
399401
color = {"red": True} if results.status else {"green": True}
400402
terminalreporter.write_line(results.unmatched_stdout, **color)
401-
if results.stderr:
402-
terminalreporter.write_line(results.stderr, yellow=True)
403+
if results.stderr:
404+
terminalreporter.write_line(results.stderr, yellow=True)
403405

404406
def pytest_unconfigure(self, config: pytest.Config) -> None:
405407
"""Clean up the mypy results path."""

0 commit comments

Comments
 (0)