我们有一个明显的测试,我们预计不会执行,因为py.test被另一个标记调用,但测试正在执行。pytest不跳过未标记的测试
例如
@pytest.mark.stress
def test_one(some_fixture):
pass
@pytest.mark.myplatform
def test_two(some_fixture):
pass
如果我运行--collectonly -m "myplatform and (not stress)
“pytest作为一个实验,我知道我可以解决这个问题。我假设使用夹具以某种方式改变标志进行评估的方式,但我们认为在使用灯具不会影响测试收集与标记的方式。有一个在灯具看标记代码,但我们不以任何方式改变pytest ARGS。 克里斯
我无法重现此问题。 '-m'选项正确地为你收集每个测试的代码和一个空的'some_fixture'。我正在使用Python 2.7.5和pytest-2.5.2。你有更多的信息吗? – 2014-03-25 00:53:06
@ user2249625请尝试我的答案http://stackoverflow.com/a/37583262/4988742让我知道,如果这对你有效。 – 2016-06-05 00:04:24