自定义标记

介绍

自定义标记首先要在pytest.ini 文件当中注册也可以通过fixture注册,不注册的话不影响使用但是执行的时候就会有警告

注册标记

# pytest.ini

[pytest]
markers =
    p0: 这是一个p0级别的标签
    p1: 这是一个p1级别的标签

使用标签

import pytest

@pytest.mark.p0
def test_01():
    pass
posted @ 2022-11-13 05:50  zhq9  阅读(131)  评论(0编辑  收藏  举报