只执行是 pytest -v -m “mark” 不执行pytest -v -m " not mark"
import pytest
@pytest.mark.webtest
def test_mark1():
assert 1==1
@pytest.mark.T2
@pytest.mark.slow
def test_mark2():
assert 1==1
#运行多个标记的用例
pytest.main(['-v', '-m',' webtest or slow', 'test_mark.py','--html=./mark_report.html'])
pytest.int文件如下,多个mark时,一定要这样写不然会识别不了,每个mark前面是一个tab的缩进
[pytest]
markers =
webtest: mark a test as a webtest.
slow: mark test as slow.
T2: mark test as slow.