Make xpass a failure again #11467
This commit is contained in:
parent
fd6dd2a545
commit
0a82add9ed
|
@ -665,7 +665,7 @@ class TestFunction:
|
|||
"""
|
||||
)
|
||||
result = pytester.runpytest()
|
||||
result.stdout.fnmatch_lines(["* 2 passed, 1 xpassed in *"])
|
||||
result.stdout.fnmatch_lines(["* 1 failed, 2 passed in *"])
|
||||
|
||||
def test_parametrize_xfail_passed(self, pytester: Pytester) -> None:
|
||||
pytester.makepyfile(
|
||||
|
|
|
@ -1949,7 +1949,7 @@ class TestMarkersWithParametrization:
|
|||
)
|
||||
pytester.makepyfile(s)
|
||||
reprec = pytester.inline_run()
|
||||
passed, failed = (2, 1) if strict else (3, 0)
|
||||
passed, failed = (2, 1)
|
||||
reprec.assertoutcome(passed=passed, failed=failed)
|
||||
|
||||
def test_parametrize_called_in_generate_tests(self, pytester: Pytester) -> None:
|
||||
|
@ -2017,7 +2017,7 @@ class TestMarkersWithParametrization:
|
|||
)
|
||||
pytester.makepyfile(s)
|
||||
reprec = pytester.inline_run()
|
||||
passed, failed = (0, 2) if strict else (2, 0)
|
||||
passed, failed = (0, 2)
|
||||
reprec.assertoutcome(passed=passed, failed=failed)
|
||||
|
||||
def test_pytest_make_parametrize_id(self, pytester: Pytester) -> None:
|
||||
|
|
|
@ -399,8 +399,8 @@ class TestLastFailed:
|
|||
assert 1
|
||||
"""
|
||||
)
|
||||
config = pytester.parseconfigure()
|
||||
assert config.cache is None
|
||||
result = pytester.runpytest()
|
||||
result.stdout.fnmatch_lines(["*1 failed in*"])
|
||||
|
||||
def test_non_serializable_parametrize(self, pytester: Pytester) -> None:
|
||||
"""Test that failed parametrized tests with unmarshable parameters
|
||||
|
|
|
@ -143,7 +143,7 @@ def test_runresult_assertion_on_xpassed(pytester: Pytester) -> None:
|
|||
"""
|
||||
)
|
||||
result = pytester.runpytest()
|
||||
result.assert_outcomes(xpassed=1)
|
||||
result.assert_outcomes(failed=1)
|
||||
assert result.ret == 0
|
||||
|
||||
|
||||
|
|
|
@ -493,7 +493,7 @@ class TestXFail:
|
|||
"""
|
||||
)
|
||||
result = pytester.runpytest(p, "-rX")
|
||||
result.stdout.fnmatch_lines(["*XPASS*test_that*", "*1 xpassed*"])
|
||||
result.stdout.fnmatch_lines(["*FAILED*test_that*", "*1 failed*"])
|
||||
assert result.ret == 0
|
||||
|
||||
def test_xfail_imperative(self, pytester: Pytester) -> None:
|
||||
|
@ -547,7 +547,7 @@ class TestXFail:
|
|||
"""
|
||||
)
|
||||
result = pytester.runpytest(p, "-rxX")
|
||||
result.stdout.fnmatch_lines(["*XFAIL*test_this*", "*XPASS*test_that*"])
|
||||
result.stdout.fnmatch_lines(["*XFAIL*test_this*", "*FAILED*test_that*"])
|
||||
|
||||
def test_dynamic_xfail_no_run(self, pytester: Pytester) -> None:
|
||||
p = pytester.makepyfile(
|
||||
|
@ -661,14 +661,14 @@ class TestXFail:
|
|||
result.stdout.fnmatch_lines(
|
||||
["*test_foo*", "*XPASS(strict)*unsupported feature*"]
|
||||
)
|
||||
else:
|
||||
result.stdout.fnmatch_lines(
|
||||
[
|
||||
"*test_strict_xfail*",
|
||||
"XPASS test_strict_xfail.py::test_foo unsupported feature",
|
||||
]
|
||||
)
|
||||
assert result.ret == (1 if strict else 0)
|
||||
# else:
|
||||
# result.stdout.fnmatch_lines(
|
||||
# [
|
||||
# "*test_strict_xfail*",
|
||||
# "XPASS test_strict_xfail.py::test_foo unsupported feature",
|
||||
# ]
|
||||
# )
|
||||
assert result.ret == (1)
|
||||
assert pytester.path.joinpath("foo_executed").exists()
|
||||
|
||||
@pytest.mark.parametrize("strict", [True, False])
|
||||
|
@ -723,9 +723,9 @@ class TestXFail:
|
|||
"""
|
||||
)
|
||||
result = pytester.runpytest(p, "-rxX")
|
||||
strict = strict_val == "true"
|
||||
result.stdout.fnmatch_lines(["*1 failed*" if strict else "*1 xpassed*"])
|
||||
assert result.ret == (1 if strict else 0)
|
||||
# strict = strict_val == "true"
|
||||
result.stdout.fnmatch_lines(["*1 failed*"])
|
||||
assert result.ret == (1)
|
||||
|
||||
def test_xfail_markeval_namespace(self, pytester: Pytester) -> None:
|
||||
pytester.makeconftest(
|
||||
|
@ -944,7 +944,7 @@ class TestSkipif:
|
|||
|
||||
@pytest.mark.parametrize(
|
||||
"marker, msg1, msg2",
|
||||
[("skipif", "SKIP", "skipped"), ("xfail", "XPASS", "xpassed")],
|
||||
[("skipif", "SKIP", "skipped"), ("xfail", "FAILED", "FAILED")],
|
||||
)
|
||||
def test_skipif_reporting_multiple(
|
||||
self, pytester: Pytester, marker, msg1, msg2
|
||||
|
@ -1076,7 +1076,7 @@ def test_reportchars(pytester: Pytester) -> None:
|
|||
)
|
||||
result = pytester.runpytest("-rfxXs")
|
||||
result.stdout.fnmatch_lines(
|
||||
["FAIL*test_1*", "XFAIL*test_2*", "XPASS*test_3*", "SKIP*four*"]
|
||||
["FAIL*test_1*", "XFAIL*test_2*", "FAIL*test_3*", "SKIP*four*"]
|
||||
)
|
||||
|
||||
|
||||
|
@ -1121,9 +1121,9 @@ def test_reportchars_all(pytester: Pytester) -> None:
|
|||
[
|
||||
"SKIP*four*",
|
||||
"XFAIL*test_2*",
|
||||
"XPASS*test_3*",
|
||||
"FAILED*test_3*",
|
||||
"ERROR*test_5*",
|
||||
"FAIL*test_1*",
|
||||
"FAILED*test_1*",
|
||||
]
|
||||
)
|
||||
|
||||
|
|
|
@ -403,11 +403,11 @@ class TestTerminal:
|
|||
|
||||
common_output = [
|
||||
"test_verbose_skip_reason.py::test_1 SKIPPED (123) *",
|
||||
"test_verbose_skip_reason.py::test_2 XPASS (456) *",
|
||||
"test_verbose_skip_reason.py::test_2 FAILED (456) *",
|
||||
"test_verbose_skip_reason.py::test_3 XFAIL (789) *",
|
||||
"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_6 FAILED *",
|
||||
"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 *",
|
||||
|
|
Loading…
Reference in New Issue