2016-05-05 36 views
2

我创建了一个包,其结构在这里给出。为什么在使用tox时不使用pip安装软件包?

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

包安装正确,我和 '画中画冻结'

我想在另一个模块中使用这个包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 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手动安装?

回答

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 
0

TOX将安装你本身测试(即./setup.py)的包,没必要添加到deps

+0

它会安装我正在测试的软件包。然而,我正在测试的包依赖于我创建的另一个包。 Tox没有找到该软件包。 – user1429322

相关问题