Skip to content

Marking individual cases as skip/xfail? #7

@smheidrich

Description

@smheidrich

In pytest's vanilla parametrization API, it's possible to mark individual cases with markers like skip or xfail using pytest.param(..., marks=...), e.g. (adapted from the example in the official docs):

@pytest.mark.parametrize(
    ("a", "b"),
    [
        (1, 2),
        (3, 4),
        pytest.param(
            (5, 6), marks=pytest.mark.xfail(reason="doesn't work yet")
        ),
    ],
)
def test_something(a, b):
    ...

Is something like that possible with pytest-parametrization as well?

It doesn't look like it to me (I could be wrong), but IMHO this would be a useful feature to have. If you're fine with introducing an extra reserved keyword argument, the most ergonomic API would probably be to have the marks parameter be part of Parametrization.case's signature, but other options would also be possible (e.g. mirroring pytest's API of treating a single pytest.param argument differently).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions