【发布时间】:2015-12-17 15:57:28
【问题描述】:
有没有一种方法可以使用 @incremental 插件,就像描述的 att Pytest: how to skip the rest of tests in the class if one has failed? 和 @pytest.mark.parametrize 一样,如下所示:
@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
我遇到的问题是,在 test_preprocess_check 第一次失败时,我的数据集的给定输入,以下 test_preprocess_check 和 test_process_check标记为“xfail”。 我期望的行为是,在我的参数化数据集的每个新“输入”处,测试将以增量方式运行。
例如:数据 = [0,1,2]
如果只有 test_preprocess_check(0) 失败:
我收到以下报告: 1 次失败,5 次失败
但我希望报告: 1 次失败,1 次失败,4 次通过
谢谢
【问题讨论】: