可以使用 pytest skip/fail 在设置中进行测试吗?

It is possible to skip/fail test in setup using pytest?

我正在使用 pytest,希望检查一下:

是否可以在设置中有条件地 skip/fail 测试(分组在 class 中)?

您可以在那里调用 pytest.skip(...)pytest.fail(...)。请参阅文档中的“Imperative xfail from within a test or setup function”。