Python / tox将依赖项安装为可编辑

Chr*_*ong 3 python testing tox

tox.ini中,您指定要在其创建的virtualenvs中安装tox的软件包 。

[testenv]
deps =
    mock
    pytest
commands =
    python setup.py test -q
    python setup.py flake8
Run Code Online (Sandbox Code Playgroud)

此示例告诉tox在运行测试之前将模拟和pytest安装到每个virtualenv中。Tox将使用pip从PyPI安装那些依赖项。

如何pip install -e从本地结帐而不是PyPI 告诉tox 一种依赖关系?我仍然希望从PyPI安装其余的依赖项。

Chr*_*ong 6

一种方法是从deps变量中删除依赖项,然后只运行本地pip install作为tox将在其测试运行中执行的第一个命令。

[testenv]
deps =
    mock
commands =
    pip install -e ~/path/to/pytest
    python setup.py test -q
    python setup.py flake8
Run Code Online (Sandbox Code Playgroud)