我正在学习使用 tox 编写测试。如何使用 tox 仅测试一项功能?例如,如果我只想测试 django-backup
extension 的 tests/test_backup_cmd.py
中的 test_simple_backup_ Generation
最佳答案
如果您在 tox.ini
中定义参数{posargs}
,则可以在执行期间传入参数。以 py.test 为例,其中
py.test -k test_simple_backup_generation
只会测试一个功能:
[tox]
envlist = py27,py35
[testenv]
deps=pytest
commands=
pip install -e .[tests,docs]
py.test {posargs}
然后运行
tox -- -k test_simple_backup_generation
关于python - 如何使用tox仅测试一个功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39015885/