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

时间:2016-02-29 10:34:30

标签: python tox

我正在尝试为项目编写一个新测试,而我只想在tox中测试一个测试。我已经完全确定其他测试都没问题,我不需要每次测试。我发现的唯一suggestion

无法使用

ERROR: InvocationError: could not find executable 

2 个答案:

答案 0 :(得分:14)

jason meridth撰写:

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

但评论中beluga.me提到了细粒度:如果您有tox.ini文件,则可能需要添加{posargs} to pytest in tox.ini

[tox]
envlist = py35

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

使用unittest运行一个测试

python3 -m unittest -q test_file.TestClassName

答案 1 :(得分:2)

运行此命令: tox -epy27 -- test_name

代表more information

相关问题