Skip to content

Commit

Permalink
Merge pull request #8128 from bluetech/skip-reason-empty
Browse files Browse the repository at this point in the history
terminal: when the skip/xfail is empty, don't show it as "()"
  • Loading branch information
bluetech authored Dec 12, 2020
2 parents 59bd0f6 + 3302ff9 commit b478275
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/_pytest/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def pytest_runtest_logreport(self, report: TestReport) -> None:
)
reason = _get_raw_skip_reason(rep)
reason_ = _format_trimmed(" ({})", reason, available_width)
if reason_ is not None:
if reason and reason_ is not None:
self._tw.write(reason_)
if self._show_progress_info:
self._write_progress_information_filling_space()
Expand Down
5 changes: 5 additions & 0 deletions testing/test_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ def test_2():
@pytest.mark.xfail(reason="789")
def test_3():
assert False
@pytest.mark.xfail(reason="")
def test_4():
assert False
"""
)
result = pytester.runpytest("-v")
Expand All @@ -370,6 +374,7 @@ def test_3():
"test_verbose_skip_reason.py::test_1 SKIPPED (123) *",
"test_verbose_skip_reason.py::test_2 XPASS (456) *",
"test_verbose_skip_reason.py::test_3 XFAIL (789) *",
"test_verbose_skip_reason.py::test_4 XFAIL *",
]
)

Expand Down

0 comments on commit b478275

Please sign in to comment.