From 0fc57a7ee306b1ce6c3a1c868139fa071c0fa02e Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 26 Nov 2015 14:33:38 +0100 Subject: [PATCH] Added constraints tox targets These are eventually going to be used in gate instead of unconstrained jobs. There is some code duplication in commands definitions, but tox does not allow to inherit definitions with {posargs} substitution. Made tox_install.sh use constraints file to install both the project and neutron dependency, if the the first argument is 'constrained'. Change-Id: I699022b285594edf3c5db10fbdac2f904dc42928 Partial-Bug: #1522503 Depends-On: Ic2f9bc047f886bf2f9a4646e7f39f3b71f0cfc79 --- tools/tox_install.sh | 13 ++++++++++--- tox.ini | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/tools/tox_install.sh b/tools/tox_install.sh index 65011717b..e8f971c60 100755 --- a/tools/tox_install.sh +++ b/tools/tox_install.sh @@ -18,6 +18,13 @@ neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?) set -e +install_cmd="pip install" +if [ "$1" = "constrained" ]; then + install_cmd="$install_cmd $2" + shift +fi +shift + if [ $neutron_installed -eq 0 ]; then echo "ALREADY INSTALLED" > /tmp/tox_install.txt echo "Neutron already installed; using existing package" @@ -31,12 +38,12 @@ elif [ -x "$ZUUL_CLONER" ]; then git://git.openstack.org \ openstack/neutron cd openstack/neutron - pip install -e . + $install_cmd -e . cd "$cwd" else echo "PIP HARDCODE" > /tmp/tox_install.txt - pip install -U -egit+https://git.openstack.org/openstack/neutron#egg=neutron + $install_cmd -U -egit+https://git.openstack.org/openstack/neutron#egg=neutron fi -pip install -U $* +$install_cmd -U $* exit $? diff --git a/tox.ini b/tox.ini index 027624af1..5eb185460 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,9 @@ skipsdist = True [testenv] setenv = VIRTUAL_ENV={envdir} usedevelop = True -install_command = {toxinidir}/tools/tox_install.sh {opts} {packages} +install_command = + constraints: {[testenv:common-constraints]install_command} + {toxinidir}/tools/tox_install.sh unconstrained {opts} {packages} deps = -r{toxinidir}/test-requirements.txt whitelist_externals = sh commands = @@ -14,6 +16,8 @@ commands = # there is also secret magic in pretty_tox.sh which lets you run in a fail only # mode. To do this define the TRACE_FAILONLY environmental variable. +[testenv:common-constraints] +install_command = {toxinidir}/tools/tox_install.sh constrained -c{env:UPPER_CONTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} [tox:jenkins] sitepackages = True @@ -23,13 +27,20 @@ downloadcache = ~/cache/pip commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [testenv:pep8] -deps = - {[testenv]deps} commands = flake8 + # pylint --rcfile=.pylintrc --output-format=colorized {posargs:neutron_lbaas} neutron-db-manage --subproject neutron-lbaas --config-file neutron_lbaas/tests/etc/neutron.conf check_migration whitelist_externals = sh +[testenv:pep8-constraints] +install_command = {[testenv:common-constraints]install_command} +commands = + flake8 + # pylint --rcfile=.pylintrc --output-format=colorized {posargs:neutron_lbaas} + neutron-db-manage --subproject neutron-lbaas --config-file neutron_lbaas/tests/etc/neutron.conf check_migration +whitelist_externals = {[testenv:pep8]whitelist_externals} + [testenv:i18n] commands = python ./tools/check_i18n.py ./neutron_lbaas ./tools/i18n_cfg.py @@ -37,16 +48,33 @@ commands = python ./tools/check_i18n.py ./neutron_lbaas ./tools/i18n_cfg.py commands = python setup.py testr --coverage --coverage-package-name=neutron_lbaas --testr-args='{posargs}' +[testenv:cover-constraints] +install_command = {[testenv:common-constraints]install_command} +commands = + python setup.py testr --coverage --coverage-package-name=neutron_lbaas --testr-args='{posargs}' + [testenv:venv] commands = {posargs} +[testenv:venv-constraints] +install_command = {[testenv:common-constraints]install_command} +commands = {posargs} + [testenv:docs] commands = python setup.py build_sphinx +[testenv:docs-constraints] +install_command = {[testenv:common-constraints]install_command} +commands = {[testenv:docs]commands} + [testenv:py34] commands = python -m testtools.run \ neutron_lbaas.tests.unit.common.cert_manager.test_barbican +[testenv:py34-constraints] +install_command = {[testenv:common-constraints]install_command} +commands = {[testenv:py34]commands} + [flake8] # E125 continuation line does not distinguish itself from next logical line # E126 continuation line over-indented for hanging indent