Merge pull request #8152 from bluetech/empty-skip
terminal: fix "(<Skipped instance>)" skip reason in test status line
This commit is contained in:
commit
02e69e5cdc
|
@ -0,0 +1 @@
|
||||||
|
Fixed "(<Skipped instance>)" being shown as a skip reason in the verbose test summary line when the reason is empty.
|
|
@ -38,7 +38,7 @@ class OutcomeException(BaseException):
|
||||||
self.pytrace = pytrace
|
self.pytrace = pytrace
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
if self.msg:
|
if self.msg is not None:
|
||||||
return self.msg
|
return self.msg
|
||||||
return f"<{self.__class__.__name__} instance>"
|
return f"<{self.__class__.__name__} instance>"
|
||||||
|
|
||||||
|
|
|
@ -1403,4 +1403,6 @@ def _get_raw_skip_reason(report: TestReport) -> str:
|
||||||
_, _, reason = report.longrepr
|
_, _, reason = report.longrepr
|
||||||
if reason.startswith("Skipped: "):
|
if reason.startswith("Skipped: "):
|
||||||
reason = reason[len("Skipped: ") :]
|
reason = reason[len("Skipped: ") :]
|
||||||
|
elif reason == "Skipped":
|
||||||
|
reason = ""
|
||||||
return reason
|
return reason
|
||||||
|
|
|
@ -366,6 +366,26 @@ class TestTerminal:
|
||||||
@pytest.mark.xfail(reason="")
|
@pytest.mark.xfail(reason="")
|
||||||
def test_4():
|
def test_4():
|
||||||
assert False
|
assert False
|
||||||
|
|
||||||
|
@pytest.mark.skip
|
||||||
|
def test_5():
|
||||||
|
pass
|
||||||
|
|
||||||
|
@pytest.mark.xfail
|
||||||
|
def test_6():
|
||||||
|
pass
|
||||||
|
|
||||||
|
def test_7():
|
||||||
|
pytest.skip()
|
||||||
|
|
||||||
|
def test_8():
|
||||||
|
pytest.skip("888 is great")
|
||||||
|
|
||||||
|
def test_9():
|
||||||
|
pytest.xfail()
|
||||||
|
|
||||||
|
def test_10():
|
||||||
|
pytest.xfail("It's 🕙 o'clock")
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
result = pytester.runpytest("-v")
|
result = pytester.runpytest("-v")
|
||||||
|
@ -375,6 +395,12 @@ class TestTerminal:
|
||||||
"test_verbose_skip_reason.py::test_2 XPASS (456) *",
|
"test_verbose_skip_reason.py::test_2 XPASS (456) *",
|
||||||
"test_verbose_skip_reason.py::test_3 XFAIL (789) *",
|
"test_verbose_skip_reason.py::test_3 XFAIL (789) *",
|
||||||
"test_verbose_skip_reason.py::test_4 XFAIL *",
|
"test_verbose_skip_reason.py::test_4 XFAIL *",
|
||||||
|
"test_verbose_skip_reason.py::test_5 SKIPPED (unconditional skip) *",
|
||||||
|
"test_verbose_skip_reason.py::test_6 XPASS *",
|
||||||
|
"test_verbose_skip_reason.py::test_7 SKIPPED *",
|
||||||
|
"test_verbose_skip_reason.py::test_8 SKIPPED (888 is great) *",
|
||||||
|
"test_verbose_skip_reason.py::test_9 XFAIL *",
|
||||||
|
"test_verbose_skip_reason.py::test_10 XFAIL (It's 🕙 o'clock) *",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue