我可以根据夹具参数 ID 使用 pytest.mark.skipif 吗?

Mid*_*ter 2 python fixture pytest

我的电脑里有一个固定装置conftest.py文件中有一个具有三个参数的装置:

@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)
Run Code Online (Sandbox Code Playgroud)

现在,在特定的长时间运行的测试函数上,我想跳过“大”情况。

@pytest.mark.skipif(...)
def test_snafu(complete):
    assert ...
Run Code Online (Sandbox Code Playgroud)

这有可能吗?

小智 5

不清楚您在寻找什么

截至目前,跳过标记评估无法访问您可能想要pytest.skip在测试函数内调用的测试元数据