繁体   English   中英

如何在 tox 中只运行一项测试?

[英]How to run only one test in tox?

我正在尝试为一个项目编写一个新测试,我只想在 tox 中测试该测试。 我已经完全确定其他测试没问题,我不需要每次都运行它们。 我发现的唯一建议不适用

ERROR: InvocationError: could not find executable 

正如jason meridth 所写

$ tox -e py35 -- project/tests/test_file.py::TestClassName::test_method

但是beluga.me在评论中提到了细粒度:如果您有一个tox.ini文件,您可能需要将{posargs}添加到 tox.ini 中的 pytest

[tox]
envlist = py35

[testenv]
deps =
    pytest
    pytest-cov
    pytest-pep8
commands =
    pip install -e .
    pytest {posargs}

使用 unittest 运行一项测试

python3 -m unittest -q test_file.TestClassName

运行此命令:

tox -epy27 -- test_name

了解 更多信息

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM