我使用tox通过以下基本配置(tox.ini
)测试python项目:
[tox]
envlist = py3
isolated_build = True
[testenv]
deps =
pytest
pytest-cov
commands =
pytest --cov {envsitepackagesdir}/foobar --cov-report xml --cov-report term
不幸的是,没有安装软件包的可选依赖项(如setup.cfg
中所指定);原始点的对应行为
pip install .[all]
如何使tox安装所有可选依赖项?
答案 0 :(得分:2)
支持的方法是使用testenv中的extras
键
例如:
[testenv]
deps = -rrequirements-dev.txt
extras = typed
这将安装.[typed]
或-e .[typed]
(如果usedevelop = true
免责声明:我是毒物维护者之一
答案 1 :(得分:0)
您可以将testenv
的依赖项更改为
[testenv]
deps =
.[all]
pytest
pytest-cov
模拟pip install .[all]