Make all tox targets constrained

Since fwaas gate has not switched to -constraints targets yet, we can
remove them right away.

Note: override install_command for releasenotes and cover targets since
corresponding gate jobs do not provide constraints file yet.

Conflicts:
	tools/tox_install.sh
	tox.ini

Change-Id: If3c143153d0a09378092791e76f1a728fb978aed
(cherry picked from commit db029ff867)
This commit is contained in:
Ihar Hrachyshka 2016-03-04 13:51:07 +01:00
parent 33c06d9c70
commit 1909e55857
2 changed files with 55 additions and 3 deletions

46
tools/tox_install.sh Executable file
View File

@ -0,0 +1,46 @@
#!/bin/sh
# Many of neutron's repos suffer from the problem of depending on neutron,
# but it not existing on pypi.
# 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.
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?)
BRANCH_NAME=stable/liberty
set -e
CONSTRAINTS_FILE=$1
shift
install_cmd="pip install"
if [ $CONSTRAINTS_FILE != "unconstrained" ]; then
install_cmd="$install_cmd -c$CONSTRAINTS_FILE"
fi
if [ $neutron_installed -eq 0 ]; then
echo "ALREADY INSTALLED" > /tmp/tox_install.txt
echo "Neutron already installed; using existing package"
elif [ -x "$ZUUL_CLONER" ]; then
echo "ZUUL CLONER" > /tmp/tox_install.txt
cwd=$(/bin/pwd)
cd /tmp
$ZUUL_CLONER --cache-dir \
/opt/git \
--branch $BRANCH_NAME \
git://git.openstack.org \
openstack/neutron
cd openstack/neutron
$install_cmd -e .
cd "$cwd"
else
echo "PIP HARDCODE" > /tmp/tox_install.txt
$install_cmd -U -egit+https://git.openstack.org/openstack/neutron@$BRANCH_NAME#egg=neutron
fi
$install_cmd -U $*
exit $?

12
tox.ini
View File

@ -6,9 +6,9 @@ skipsdist = True
[testenv]
setenv = VIRTUAL_ENV={envdir}
usedevelop = True
install_command = pip install -U {opts} {packages}
deps = -egit+https://git.openstack.org/openstack/neutron@stable/liberty#egg=neutron
-r{toxinidir}/requirements.txt
install_command =
{toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/liberty} {opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
whitelist_externals = sh
commands =
@ -35,6 +35,8 @@ sitepackages = True
downloadcache = ~/cache/pip
[testenv:releasenotes]
# TODO(ihrachys): remove once infra supports constraints for this target
install_command = {toxinidir}/tools/tox_install.sh unconstrained {opts} {packages}
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:pep8]
@ -48,10 +50,14 @@ whitelist_externals = sh
commands = python ./tools/check_i18n.py ./neutron_fwaas ./tools/i18n_cfg.py
[testenv:cover]
# TODO(ihrachys): remove once infra supports constraints for this target
install_command = {toxinidir}/tools/tox_install.sh unconstrained {opts} {packages}
commands =
python setup.py testr --coverage --coverage-package-name=neutron_fwaas --testr-args='{posargs}'
[testenv:venv]
# TODO(ihrachys): remove once infra supports constraints for this target
install_command = {toxinidir}/tools/tox_install.sh unconstrained {opts} {packages}
commands = {posargs}
[testenv:docs]