2017-08-09 57 views
4

相關聯。在Pytest所有的測試,我們有pytest --markers命令,它會列出所有可使用的標記。清單與給定的標記在Pytest

但是,我沒有看到命令列出與x標記關聯的測試。文檔似乎沒有涵蓋這個,所以Pytest中有這種可能性嗎?

回答

6

使用--collect-only一起選擇中與-m <marker>

$ py.test --collect-only -m x 
=========================== test session starts =========================== 
platform linux -- Python 3.6.2, pytest-3.2.1, py-1.4.34, pluggy-0.4.0 
rootdir: /home/they4kman/.virtualenvs/tmp-e1f1b42d6ff9bfa/src, inifile: 
collected 3 items               
<Module 'test_markers.py'> 
    <Function 'test_x'> 

====================== no tests ran in 0.00 seconds ======================= 
+1

這完美地工作,謝謝! – Wunderbread