remove assert outcome from xfail summary, as it breaks [NOTRUN] functionality

This commit is contained in:
Brian Okken 2023-12-25 16:15:22 -08:00
parent b0cb867cc0
commit 5d726faad0
3 changed files with 11 additions and 9 deletions

View File

@ -1182,10 +1182,12 @@ class TerminalReporter:
def show_xfailed(lines: List[str]) -> None:
xfailed = self.stats.get("xfailed", [])
for rep in xfailed:
color = _color_for_type.get("xfailed", _color_for_type_default)
line = _get_line_with_reprcrash_message(
self.config, rep, self._tw, {color: True}
verbose_word = rep._get_verbose_word(self.config)
markup_word = self._tw.markup(
verbose_word, **{_color_for_type["warnings"]: True}
)
nodeid = _get_node_id_with_markup(self._tw, self.config, rep)
line = f"{markup_word} {nodeid}"
reason = rep.wasxfail
if reason:
line += " - " + str(reason)

View File

@ -649,7 +649,7 @@ class TestXFail:
result.stdout.fnmatch_lines(
[
"*test_strict_xfail*",
"XPASS test_strict_xfail.py::test_foo unsupported feature",
"XPASS test_strict_xfail.py::test_foo - unsupported feature",
]
)
assert result.ret == (1 if strict else 0)

View File

@ -2631,8 +2631,8 @@ def test_summary_xfail_reason(pytester: Pytester) -> None:
"""
)
result = pytester.runpytest("-rx")
expect1 = "XFAIL test_summary_xfail_reason.py::test_xfail - assert False"
expect2 = "XFAIL test_summary_xfail_reason.py::test_xfail_reason - assert False - foo"
expect1 = "XFAIL test_summary_xfail_reason.py::test_xfail"
expect2 = "XFAIL test_summary_xfail_reason.py::test_xfail_reason - foo"
result.stdout.fnmatch_lines([expect1, expect2])
assert result.stdout.lines.count(expect1) == 1
assert result.stdout.lines.count(expect2) == 1
@ -2660,7 +2660,7 @@ def test_summary_xfail_tb(pytester: Pytester) -> None:
"E *assert 1 == 2*",
"test_summary_xfail_tb.py:6: AssertionError*",
"*= short test summary info =*",
"XFAIL test_summary_xfail_tb.py::test_xfail - assert 1 == 2",
"XFAIL test_summary_xfail_tb.py::test_xfail",
"*= 1 xfailed in * =*"
])
@ -2681,7 +2681,7 @@ def test_xfail_tb_line(pytester: Pytester) -> None:
"*= XFAILURES =*",
"*test_xfail_tb_line.py:6: assert 1 == 2",
"*= short test summary info =*",
"XFAIL test_xfail_tb_line.py::test_xfail - assert 1 == 2",
"XFAIL test_xfail_tb_line.py::test_xfail",
"*= 1 xfailed in * =*"
])
@ -2724,7 +2724,7 @@ def test_xpass_output(pytester: Pytester) -> None:
"*_ test_pass _*",
"*- Captured stdout call -*",
"*= short test summary info =*",
"XPASS test_xpass_output.py::test_pass",
"XPASS test_xpass_output.py::test_pass*",
"*= 1 xpassed in * =*"
])