Remove support for applying marks to values in parametrize

Fix #3082
This commit is contained in:
Bruno Oliveira
2018-12-20 16:13:43 -02:00
parent d888d5c933
commit c378cb4793
7 changed files with 110 additions and 141 deletions

View File

@@ -1372,7 +1372,6 @@ class TestMetafuncFunctionalAuto(object):
assert output.count("preparing foo-3") == 1
@pytest.mark.filterwarnings("ignore:Applying marks directly to parameters")
@pytest.mark.issue308
class TestMarkersWithParametrization(object):
def test_simple_mark(self, testdir):
@@ -1382,7 +1381,7 @@ class TestMarkersWithParametrization(object):
@pytest.mark.foo
@pytest.mark.parametrize(("n", "expected"), [
(1, 2),
pytest.mark.bar((1, 3)),
pytest.param(1, 3, marks=pytest.mark.bar),
(2, 3),
])
def test_increment(n, expected):
@@ -1402,7 +1401,7 @@ class TestMarkersWithParametrization(object):
@pytest.mark.parametrize(("n", "expected"), [
(1, 2),
pytest.mark.foo((2, 3)),
pytest.param(2, 3, marks=pytest.mark.foo),
(3, 4),
])
def test_increment(n, expected):
@@ -1442,7 +1441,7 @@ class TestMarkersWithParametrization(object):
@pytest.mark.parametrize(("n", "expected"), [
(1, 2),
pytest.mark.xfail((1, 3)),
pytest.param(1, 3, marks=pytest.mark.xfail),
(2, 3),
])
def test_increment(n, expected):
@@ -1459,7 +1458,7 @@ class TestMarkersWithParametrization(object):
@pytest.mark.parametrize("n", [
2,
pytest.mark.xfail(3),
pytest.param(3, marks=pytest.mark.xfail),
4,
])
def test_isEven(n):
@@ -1475,7 +1474,7 @@ class TestMarkersWithParametrization(object):
@pytest.mark.parametrize(("n", "expected"), [
(1, 2),
pytest.mark.xfail("True")((1, 3)),
pytest.param(1, 3, marks=pytest.mark.xfail("True")),
(2, 3),
])
def test_increment(n, expected):
@@ -1491,7 +1490,7 @@ class TestMarkersWithParametrization(object):
@pytest.mark.parametrize(("n", "expected"), [
(1, 2),
pytest.mark.xfail(reason="some bug")((1, 3)),
pytest.param(1, 3, marks=pytest.mark.xfail(reason="some bug")),
(2, 3),
])
def test_increment(n, expected):
@@ -1507,7 +1506,7 @@ class TestMarkersWithParametrization(object):
@pytest.mark.parametrize(("n", "expected"), [
(1, 2),
pytest.mark.xfail("True", reason="some bug")((1, 3)),
pytest.param(1, 3, marks=pytest.mark.xfail("True", reason="some bug")),
(2, 3),
])
def test_increment(n, expected):
@@ -1522,9 +1521,11 @@ class TestMarkersWithParametrization(object):
s = """
import pytest
m = pytest.mark.xfail("sys.version_info > (0, 0, 0)", reason="some bug", strict={strict})
@pytest.mark.parametrize(("n", "expected"), [
(1, 2),
pytest.mark.xfail("sys.version_info > (0, 0, 0)", reason="some bug", strict={strict})((2, 3)),
pytest.param(2, 3, marks=m),
(3, 4),
])
def test_increment(n, expected):
@@ -1548,7 +1549,7 @@ class TestMarkersWithParametrization(object):
failingTestData = [(1, 3),
(2, 2)]
testData = passingTestData + [pytest.mark.xfail(d)
testData = passingTestData + [pytest.param(*d, marks=pytest.mark.xfail)
for d in failingTestData]
metafunc.parametrize(("n", "expected"), testData)