[CI] Add upper constraints to install command

In cases when a package is installed in tox's develop-inst phase upper
constraints are not used if it were not defined in 'deps' of the tox
target. This caused for example 'tox -e docs' to fail in case a package
introduced some branch incompatible change.

There are two option to fix this:
* add the upper constraints to 'deps' of the target (and pre-install
  requirements for some cases) OR
* use it in the install_command

In the past the latter needed some extra attention (due to e.g. lower
constraints tests) and projects were encouraged to remove the
install_command, but nowadays this seems better fitting for some
project and easier to use. So this patch fixes the upper constraints
usage via the custom install_command and by removing it from 'deps'.

Change-Id: Iae07e1c5abde09874928951ac55c2d0355bcd244
This commit is contained in:
Elod Illes 2022-04-28 18:00:47 +02:00
parent 14bd3eb1bb
commit 36aedba20e

View File

@ -24,9 +24,8 @@ setenv =
# clue for oslo.db to use file-based database.
OS_TEST_DBAPI_ADMIN_CONNECTION=sqlite:////tmp/placeholder-never-created-nor-used.db
usedevelop = True
install_command = pip install {opts} {packages}
deps = -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
install_command = python -m pip install -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} {opts} {packages}
deps = -r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
commands =
find . -type f -name "*.pyc" -delete
@ -103,7 +102,6 @@ commands =
# This environment is called from CI scripts to test and publish
# the API Ref to docs.openstack.org.
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands =
rm -rf api-ref/build
@ -151,7 +149,6 @@ paths = ./glance/hacking
[testenv:docs]
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands =
rm -fr doc/build
@ -166,7 +163,6 @@ commands = {posargs}
[testenv:releasenotes]
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html