简体   繁体   English

Tox自动安装不需要的软件包

[英]Tox automatically installing unwanted package

I am trying to get the coverage of my tests using TOX and Travis CI. 我正在尝试使用TOX和Travis CI进行测试。 Unfortunately when creating the virtual envs, TOX install my package from PIP, thus not testing the coverage of the actual source code... 不幸的是,在创建虚拟环境时,TOX从PIP安装了我的软件包,因此没有测试实际源代码的覆盖范围...

How can I prevnt that to happen. 我如何防止这种情况发生。

I guess the easiest way to explain is to try: 我想最简单的解释方法是尝试:

Clone this: https://github.com/millerf/django-channels-jsonrpc 克隆它: https : //github.com/millerf/django-channels-jsonrpc

Create a venv 创建一个venv

$>virtualenv venv/

And finally: 最后:

$> pip install tox
$> tox -ecoverage 

The coverage does not include channels_jsonrpc/, as tox installed the package in his own venv... 涵盖范围不包括channels_jsonrpc /,因为tox将软件包安装在自己的平台上。

how can I prevent the install of one package with tox? 如何防止使用Tox安装一个软件包?

Tox will install any package you provide in his own env, that's how it works, to make it use your local repo instead of installing a remote version, try changing the deps part of the tox.ini file to: Tox将在您自己的环境中安装您提供的任何软件包,这就是它的工作原理,以使其使用本地存储库而不是安装远程版本,请尝试将tox.ini文件的deps部分更改为:

deps =
    {toxinidir}
    coverage
    coveralls

just always make sure that setup.py is in the root of {toxinidir} path. 只要始终确保setup.py位于{toxinidir}路径的根目录中{toxinidir}

You can test it by changing something in your package locally then run tox -ecoverage and verify which lib tox installed by checking ./tox/coverage/lib/python{version}/site-packages/channels_jsonrpc/ 您可以通过在本地更改软件包中的内容进行测试,然后运行tox -ecoverage并通过检查./tox/coverage/lib/python{version}/site-packages/channels_jsonrpc/验证安装了哪个lib tox

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM