This commit is contained in:
Gleb Nikonorov 2020-06-04 00:52:26 -04:00
parent feeddb9882
commit 2d7eb039c3
1 changed files with 35 additions and 0 deletions

View File

@ -475,6 +475,41 @@ class TestXFail:
result.stdout.fnmatch_lines(["*1 passed*"]) result.stdout.fnmatch_lines(["*1 passed*"])
assert result.ret == 0 assert result.ret == 0
@pytest.mark.parametrize("strict", [True, False])
def test_runxfail_with_empty_parameter_set_mark_xfail(self, testdir, strict):
testdir.makeini(
"""
[pytest]
xfail_strict = %s
"""
% strict
)
p = testdir.makepyfile(
"""
import pytest
@pytest.mark.parametrize(
('a', 'b'),
# no cases defined yet
(
),
)
def test(a, b):
assert 1 == 1
"""
)
result = testdir.runpytest(
p, "--runxfail", "-o", "empty_parameter_set_mark=xfail"
)
result.stdout.fnmatch_lines(["*1 failed*" if strict else "*1 passed*"])
if strict:
result.stdout.fnmatch_lines(
["*XPASS(strict)] got empty parameter set ('a', 'b')*"]
)
assert result.ret == (1 if strict else 0)
@pytest.mark.parametrize("strict_val", ["true", "false"]) @pytest.mark.parametrize("strict_val", ["true", "false"])
def test_strict_xfail_default_from_file(self, testdir, strict_val): def test_strict_xfail_default_from_file(self, testdir, strict_val):
testdir.makeini( testdir.makeini(