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

Python/tox Install a dependency as editable

tox.ini, you specify the packages that you want tox 中安装到它创建的 virtualenvs 中。

[testenv]
deps =
    mock
    pytest
commands =
    python setup.py test -q
    python setup.py flake8

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

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

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

[testenv]
deps =
    mock
commands =
    pip install -e ~/path/to/pytest
    python setup.py test -q
    python setup.py flake8