运行与更改的文件相关的测试
pytest-picked的Python项目详细描述
运行与未分页文件或当前分支相关的测试(根据git)
-
假设您有来自git status的以下输出:
$ git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) Untracked files: (use "git add <file>..." to include in what will be committed) api.py tests/api/ tests/test_board.py nothing added to commit but untracked files present (use "git add" to track)
运行pytest --picked,插件将运行来自此输出的所有测试
$ pytest --picked ============================= test session starts ============================= platform darwin -- Python 3.6.4, pytest-3.6.0, py-1.5.3, pluggy-0.6.0 rootdir: /Users/ana.gomes/personal-workspace/grandma, inifile: plugins: picked-0.1.0, mock-1.10.0, flask-0.10.0, deadfixtures-2.0.1 collecting 34 items Changed test files... 1. ['tests/test_board.py'] Changed test folders... 1. ['tests/api/'] collected 34 items tests/test_board.py . [ 50%] tests/api/test_new.py . [100%] =========================== 2 passed in 0.07 seconds ===========================
所有测试都将从已修改但尚未提交的文件和文件夹中运行。 不再复制粘贴!
用法
$ pytest --picked $ pytest --picked=first $ pytest --picked --mode=branch $ pytest --picked --mode=unstaged # default
功能
使用git status,此插件允许您:
- 仅从修改的测试文件运行测试
- 首先从修改的测试文件运行测试,然后运行所有未修改的测试
贡献
我们非常欢迎您的贡献。可以使用tox运行测试,请确保 在提交请求之前,覆盖范围至少保持不变。
许可证
根据MIT许可证的条款分发,“pytest picked”是免费的开源软件
问题
如果您遇到任何问题,请file an issue连同详细说明。