我們有一個明顯的測試,我們預計不會執行,因爲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