# 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": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "pytest, py.test, pytest-level, test priority, pytest priority",
"author": "Han Zhichao",
"author_email": "superhin@126.com",
"download_url": "https://files.pythonhosted.org/packages/fa/44/4d37033f685809b9c5982ab55d85992aa3de0d0c444b84bfee0724a7ff88/pytest_priority-0.1.1.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.1",
"project_urls": {
"Homepage": "http://github.com/hanzhichao/pytest-priority"
},
"split_keywords": [
"pytest",
" py.test",
" pytest-level",
" test priority",
" pytest priority"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fa444d37033f685809b9c5982ab55d85992aa3de0d0c444b84bfee0724a7ff88",
"md5": "f9b57bcd541e79b8d383dd81b4bcd783",
"sha256": "86fa9c95a26b90f1f086529a9f10ca2f3d7185f3c9c17897b53719f2945a59c9"
},
"downloads": -1,
"filename": "pytest_priority-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "f9b57bcd541e79b8d383dd81b4bcd783",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2133,
"upload_time": "2024-08-19T08:37:25",
"upload_time_iso_8601": "2024-08-19T08:37:25.003606Z",
"url": "https://files.pythonhosted.org/packages/fa/44/4d37033f685809b9c5982ab55d85992aa3de0d0c444b84bfee0724a7ff88/pytest_priority-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-19 08:37:25",
"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"
}