[py.test]:测试依赖项

时间:2012-09-12 14:59:22

标签: python pytest

我正在使用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?

1 个答案:

答案 0 :(得分:4)

您可能需要查看pytest-dependency。它是一个插件,允许您在某些其他测试失败时跳过某些测试。

相关问题