混合跳过(xfail)是有使用@incremental插件等中描述的att Pytest: how to skip the rest of tests in the class if one has failed?混合@ pytest.mark.parametrize像下面的方式:Pytest - 与参数多态
@pytest.mark.incremental
Class TestClass:
@pytest.mark.parametrize("input", data)
def test_preprocess_check(self,input):
# prerequisite for test
@pytest.mark.parametrize("input",data)
def test_process_check(self,input):
# test only if test_preprocess_check succeed
i是所遇到的问题,在test_preprocess_check与我的数据集的给定输入的第一次失败,以下test_preprocess_check和test_process_check被标记为“xfail”。 我期望的行为将会是,在我参数化数据集的每个新“输入”处,测试都将以增量方式进行。
例如:数据= [0,1,2]
如果只test_preprocess_check(0)失败:
我得到以下报告: 1失败,5 xfailed
但我预计报告: 1失败,1 xfailed,4传递
感谢
小心_genid是由您的“输入”数据集组成的,因此可能导致无效的变量名称,将其映射到100%有效的变量名称可以避免一些问题 – Floghi