2

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

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

软件包安装正确,我检查了“pip freeze”

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

毒物

 [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 安装?

4

2 回答 2

1

根据 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
于 2016-05-05T04:27:33.417 回答
0

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

于 2016-05-05T09:09:51.497 回答