Python 测试工具 tox
似乎是为与 virtualenv 一起工作而设计的。它也可以在基于 conda/anaconda 的 Python 安装上运行吗?
最佳答案
tox-conda插件现在应该可以弥补这个差距,但需要积极使用 conda 的贡献者来测试和改进它。
来自自述文件:
tox-conda
is a plugin that provides integration with the conda package and environment manager for the tox automation tool. It's like having your cake and eating it, too!By default,
tox
creates isolated environments using [virtualenv](https://virtualenv.pypa.io] and installs dependencies frompip
.In contrast, when using the
tox-conda
plugintox
will useconda
to create environments, and will install specified dependencies fromconda
. This is useful for developers who rely onconda
for environment management and package distribution but want to take advantage of the features provided bytox
for test automation.
要安装该插件,它需要与 tox 一起安装在同一个虚拟环境中。要创建一个包含 tox
和 tox-conda
的虚拟环境,这就足够了:
$ python3 -m venv toxbase
$ toxbase/bin/pip install tox tox-conda
[...]
Successfully installed tox-3.13.2 tox-conda-0.2.0
$ toxbase/bin/tox --version
3.13.1 imported from /home/ob/tmp/toxbase/lib/python3.6/site-packages/tox/__init__.py
registered plugins:
tox-conda-0.2.0 at /home/ob/tmp/toxbase/lib/python3.6/site-packages/tox_conda/plugin.py
从那时起,tox 可以用作命令行工具,并通过在 toxbase
virtualenv 中升级它来保持最新状态。另一种更自动化的方法是使用 pipx
关于python - 是否可以在基于 conda 的 Python 安装中使用 tox?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30555943/