我正在尝试为项目编写一个新测试,我只想在tox中测试一个测试.我已经完全确定其他测试都没问题,我不需要每次都运行它们.我发现的唯一建议不起作用
ERROR: InvocationError: could not find executable
Run Code Online (Sandbox Code Playgroud)
Mar*_*oma 24
$ tox -e py35 -- project/tests/test_file.py::TestClassName::test_method
Run Code Online (Sandbox Code Playgroud)
但beluga.me在评论中提到了细粒度:如果你有一个tox.ini文件,你可能需要{posargs}在tox.ini中添加到pytest:
[tox]
envlist = py35
[testenv]
deps =
pytest
pytest-cov
pytest-pep8
commands =
pip install -e .
pytest {posargs}
Run Code Online (Sandbox Code Playgroud)
python3 -m unittest -q test_file.TestClassName
Run Code Online (Sandbox Code Playgroud)
运行此命令:
tox -epy27 -- test_name
Run Code Online (Sandbox Code Playgroud)
了解更多信息。