我正在使用 py.test 编写测试系统,并寻找一种方法根据其他测试运行结果来执行特定的测试。
例如,我们有一个标准的测试类:
import pytest
class Test_Smoke:
def test_A(self):
pass
def test_B(self):
pass
def test_C(self):
pass
如果test_A()和test_B()都通过了,那么应该执行test_C(),否则跳过。
我需要在测试或测试类级别上做类似的事情(例如,如果Test_Smoke全部通过,则执行Test_Perfo),但我无法找到使用标准方法(例如@ pytest.mark.skipif)的解决方案。
在pytest中是否可能实现?