pytest xfail parametrize

Solutions on MaxInterview for pytest xfail parametrize by the best coders in the world

showing results for - "pytest xfail parametrize"
Finlay
30 Jan 2021
1import sys
2import pytest
3
4
5@pytest.mark.parametrize(
6    ("n", "expected"),
7    [
8        (1, 2),
9        pytest.param(1, 0, marks=pytest.mark.xfail),
10        pytest.param(1, 3, marks=pytest.mark.xfail(reason="some bug")),
11        (2, 3),
12        (3, 4),
13        (4, 5),
14        pytest.param(
15            10, 11, marks=pytest.mark.skipif(sys.version_info >= (3, 0), reason="py2k")
16        ),
17    ],
18)
19def test_increment(n, expected):
20    assert n + 1 == expected