pythonpytestfixture

Can I use pytest.mark.skipif based on fixture parameter ID?


I have a fixture in my conftest.py file that has three parameters:

@pytest.fixture(scope="session",
        params=[(33, 303), (303, 3003), (3003, 300003)],
        ids=["small", "medium", "large"])
def complete(request):
    np.random.seed(1234567890)
    return np.random.rand(*request.param)

Now on a specific long running test function I would like to skip the "large" case.

@pytest.mark.skipif(...)
def test_snafu(complete):
    assert ...

Is this somehow possible?


Solution

  • its not clear what you are looking for

    as of now, skip marker evaluation does not have access to test metadata you might want to invoke pytest.skip inside the test function