Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python [py.test]:测试依赖项_Python_Pytest - Fatal编程技术网

Python [py.test]:测试依赖项

Python [py.test]:测试依赖项,python,pytest,Python,Pytest,我正在使用py.test编写测试系统,并寻找一种根据其他测试运行结果执行特定测试的方法 例如,我们有标准测试类: import pytest class Test_Smoke: def test_A(self): pass def test_B(self): pass def test_C(self): pass 如果通过了测试A()和测试B(),则应执行测试C(),否则-跳过 我需要一种在测试或测试类级别执行类似操作的方法(例

我正在使用py.test编写测试系统,并寻找一种根据其他测试运行结果执行特定测试的方法

例如,我们有标准测试类:

import pytest

class Test_Smoke:
   def test_A(self):
       pass

   def test_B(self):
       pass

   def test_C(self):
       pass
如果通过了测试A()和测试B(),则应执行测试C(),否则-跳过

我需要一种在测试或测试类级别执行类似操作的方法(例如,如果所有测试都通过,则执行test_Perfo),但我无法使用标准方法(如@pytest.mark.skipif)找到解决方案


使用pytest有可能吗?

您可能想看看。它是一个插件,允许您在其他测试失败时跳过某些测试。

这是可能的,但没有直接选项。您想在模块级还是测试类级执行此操作?(“…测试或测试类级别”没有为我完全解析)是的,首先是在测试类级别。但如果有可能针对特定的测试用例,那就太好了:例如,“如果测试A失败,跳过测试B”,或者甚至类似“测试B需要测试A”…可能的重复