Get tempest via zuul-cloner if needed and it is available

Change-Id: I70f402202f99a989ef5e95213669f4ca9f7b706f
This commit is contained in:
Doug Wiegley 2016-01-29 10:54:03 -07:00
parent a2fe5fd2e0
commit 828068181c
2 changed files with 41 additions and 6 deletions

37
tools/tox_install.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
# Many of neutron's repos suffer from the problem of depending on neutron,
# but it not existing on pypi. -- Well, that's the usual issue, but in
# neutron's case, we want to import tempest directly for the api tests.
# This wrapper for tox's package installer will use the existing package
# if it exists, else use zuul-cloner if that program exists, else grab it
# from neutron master via a hard-coded URL. That last case should only
# happen with devs running unit tests locally.
# From the tox.ini config page:
# install_command=ARGV
# default:
# pip install {opts} {packages}
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
tempest_installed=$(python -c "import tempest" 2>/dev/null ; echo $?)
set -e
if [ $tempest_installed -eq 0 ]; then
echo "Tempest already installed; using existing package"
elif [ -x "$ZUUL_CLONER" ]; then
export ZUUL_BRANCH=${ZUUL_BRANCH-$BRANCH}
pushd /tmp
$ZUUL_CLONER --cache-dir \
/opt/git \
git://git.openstack.org \
openstack/tempest
pip install -e openstack/tempest
popd
else
pip install -U -egit+https://git.openstack.org/openstack/tempest#egg=tempest
fi
pip install -U $*

10
tox.ini
View File

@ -26,17 +26,15 @@ setenv = {[testenv]setenv}
OS_TEST_PATH=./neutron/tests/api
TEMPEST_CONFIG_DIR={env:TEMPEST_CONFIG_DIR:/opt/stack/tempest/etc}
OS_TEST_API_WITH_REST=1
deps =
{[testenv]deps}
git+https://git.openstack.org/openstack/tempest#egg=tempest
install_command =
constraints: {[testenv:common-constraints]install_command}
{toxinidir}/tools/tox_install.sh {opts} {packages}
[testenv:api-constraints]
basepython = {[testenv:api]basepython}
install_command = {[testenv:common-constraints]install_command}
passenv = {[testenv:api]passenv}
setenv = {[testenv:api]setenv}
deps =
{[testenv:api]deps}
install_command = {toxinidir}/tools/tox_install.sh -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
[testenv:common]
# Fake job to define environment variables shared between dsvm/non-dsvm jobs