Add constraint target to tox.ini

This adds a pip install command to tox.ini that is only used when the
tox env is passed with the 'constraints' factor appended onto it.
As such this will not effect developer workflows or current unit tests.

The initial use of this will be in a non-voting job, to verify that the
constrained checks with tox are stable.  DevStack is already running
constrained jobs, as such problems are not expected.

To run a tox with pip using constraints on a developer system a
developer should run the desired tox environment with -constraints.
For example: $(tox -epy27-constraints)
Pip will pull the current version of the upper-constraints.txt file down
from the git.openstack.org, however this method can be overriden to use
a local file setting the environment variable "UPPER_CONSTRAINTS_FILE"
to the local path or a different URL, it is passed directly to pip.

This is currently not enabled in the default tox run, however it is
possible to enable it as a default by adding it to 'envlist' in tox.ini

Backport of Nova commit ad38ce1fc98692ee59ef061de1a35f355d219aa1

Change-Id: Ia3cfb30fd1d8529bb4fbcf8873036149ea6f483c
Implements Blueprint: Requirements-Management
This commit is contained in:
John L. Villalovos 2015-09-04 11:57:16 -07:00
parent 9fecabbe3d
commit 3f6e443232

View File

@ -1,11 +1,13 @@
[tox]
minversion = 1.6
minversion = 1.8
skipsdist = True
envlist = py34,py27,pep8
[testenv]
usedevelop = True
install_command = pip install -U {opts} {packages}
install_command =
constraints: pip install -U --force-reinstall -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
pip install -U {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
PYTHONDONTWRITEBYTECODE = 1
LANGUAGE=en_US