为什么在使用 tox 时 pip 不安装包?

why doesn't pip install package when using tox?

我创建了一个包,其结构在此处给出。

packagename
   -- packagename
         -- __init__.py
   -- setup.py

软件包安装正确,我用 'pip freeze'

检查过

我正在尝试在另一个带有 tox 的模块中使用这个包

tox.ini

 [tox]
  envlist = dev
 [default-dependencies]
  deps = packagename
 [testenv:dev]
  deps = {[default-dependencies]deps}
  pip_pre=True
  ignore_errors=True
  commands = py.test blah

当我尝试使用

tox -e dev

我收到此错误消息

Collecting packagename
Could not find a version that satisfies the requirement packagename (from versions: )
No matching distribution found for packagename
v = InvocationError('/Users/***/.tox/dev/bin/pip install --pre dlb_dcp_csaf')

不过这样安装就一切正常了

 pip install --pre packagename 

我检查了两者的 pip 版本

 pip 8.1.1 from /usr/local/lib/python2.7/site-packages (python 2.7)
 pip 8.1.1 from /Users/***/.tox/dev/lib/python2.7/site-packages (python 2.7)

任何人都可以帮助我为什么不能使用 tox 安装软件包但可以使用 pip 手动安装?

根据 tox 命令的输出,您似乎没有指定包名的正确路径,因此 tox 正在尝试在 PIP 服务器上查找它。您必须指定相对于 tox.ini 所在目录的包名称的正确路径。

发件人:http://testrun.org/tox/latest/config.html

deps=MULTI-LINE-LIST
test-specific dependencies - to be installed into the environment prior to 
project package installation. Each line defines a dependency, which will be     
passed to the installer command for processing. Each line specifies a file, 
a URL or a package name.

...

(Experimentally introduced in 1.6.1) all installer commands are executed 
using the {toxinidir} as the current working directory.

{toxinidir}
the directory where tox.ini is located

tox 将自行安装您正在测试的软件包(即 ./setup.py),无需将其添加到 deps.