如何向tox的virtualenv添加引导脚本?

Jon*_*Jon 5 python psycopg2 virtualenv setup.py tox

我的测试需要psycopg2和lxml,但是当我尝试通过tox将它安装在virtualenv中时,由于缺少pg_conf或其他依赖项而失败.

我找到了bootstrap脚本的这个解释:http://www.virtualenv.org/en/latest/index.html#bootstrap-example

如何向tox的virtualenv添加引导脚本?你知道我关注的任何好例子(lxml和psycopg2)吗?

Sim*_*pin 5

我认为你不能在tox中使用bootstrap脚本(如virtualenv docs中所述).但是,您可以将tox.ini文件配置为安装未指定的Python依赖项setup.py,并在运行测试之前运行任意命令.从tox主页:

# content of: tox.ini , put in same dir as setup.py
[tox]
envlist = py26,py27
[testenv]
deps=pytest       # install pytest in the venvs
commands=py.test  # or 'nosetests' or ...
Run Code Online (Sandbox Code Playgroud)

depscommands实际上列出:

deps=
    lxml
    psycopg2
    pytest
commands=
    ./some_other_script.sh
    py.test
Run Code Online (Sandbox Code Playgroud)

但是忘掉引导脚本并退后一步.pg_conf最初的问题是什么?