# Pytest-Priority
为用例添加优先级标记,并支持按优先级筛选用例执行
## 安装方法
```shell
pip install pytest-priority
```
## 使用方法
1. 标记优先级
```python
# test_demo.py
import pytest
@pytest.mark.priority('p0')
def test_a():
pass
@pytest.mark.priority('p1')
def test_b():
pass
@pytest.mark.priority('p2')
def test_c():
pass
```
2. 筛选测试用例,例如运行优先级为p0和p1的用例
```shell
pytest test_demo.py --priority=p0 --priority=p1
```
Raw data
{
"_id": null,
"home_page": "http://github.com/hanzhichao/pytest-priority",
"name": "pytest-priority",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Han Zhichao",
"author_email": "superhin@126.com",
"download_url": "https://files.pythonhosted.org/packages/0b/44/dcd0cc40f7f76471c9cad594585651779218e5d15c5a050bf8f83cdd970b/pytest-priority-0.1.0.tar.gz",
"platform": null,
"description": "# Pytest-Priority\n\u4e3a\u7528\u4f8b\u6dfb\u52a0\u4f18\u5148\u7ea7\u6807\u8bb0\uff0c\u5e76\u652f\u6301\u6309\u4f18\u5148\u7ea7\u7b5b\u9009\u7528\u4f8b\u6267\u884c\n\n## \u5b89\u88c5\u65b9\u6cd5\n```shell\npip install pytest-priority\n```\n\n## \u4f7f\u7528\u65b9\u6cd5\n1. \u6807\u8bb0\u4f18\u5148\u7ea7\n```python\n# test_demo.py\nimport pytest\n\n@pytest.mark.priority('p0')\ndef test_a():\n pass\n\n@pytest.mark.priority('p1')\ndef test_b():\n pass\n\n@pytest.mark.priority('p2')\ndef test_c():\n pass\n```\n2. \u7b5b\u9009\u6d4b\u8bd5\u7528\u4f8b,\u4f8b\u5982\u8fd0\u884c\u4f18\u5148\u7ea7\u4e3ap0\u548cp1\u7684\u7528\u4f8b\n```shell\npytest test_demo.py --priority=p0 --priority=p1\n```\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "pytest plugin for add priority for tests",
"version": "0.1.0",
"project_urls": {
"Homepage": "http://github.com/hanzhichao/pytest-priority"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0b44dcd0cc40f7f76471c9cad594585651779218e5d15c5a050bf8f83cdd970b",
"md5": "41e25dcd87c163de428f1f594e3ea16b",
"sha256": "953c0d7f66a576b31801b91f5b7f3389567a780d686a07e96c2fec477e16c34f"
},
"downloads": -1,
"filename": "pytest-priority-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "41e25dcd87c163de428f1f594e3ea16b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2258,
"upload_time": "2023-07-23T11:05:24",
"upload_time_iso_8601": "2023-07-23T11:05:24.013372Z",
"url": "https://files.pythonhosted.org/packages/0b/44/dcd0cc40f7f76471c9cad594585651779218e5d15c5a050bf8f83cdd970b/pytest-priority-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-23 11:05:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hanzhichao",
"github_project": "pytest-priority",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "pytest-priority"
}