清单与给定的标记在Pytest
问题描述:
相关联。在Pytest所有的测试,我们有pytest --markers
命令,它会列出所有可使用的标记。清单与给定的标记在Pytest
但是,我没有看到命令列出与x标记关联的测试。文档似乎没有涵盖这个,所以Pytest中有这种可能性吗?
答
使用--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 =======================
这完美地工作,谢谢! – Wunderbread