Skip to content

Commit c716285

Browse files
author
Matt Riedemann
committed
Use upper-constraints when running tox
This is basically a copy of the template used in oslo.messaging under change 78f113780510b741bc974c69eb9b0718cd657c1d. Change-Id: I8be883215f27abb58d15b85e8542cbdf32000bac
1 parent 83106a4 commit c716285

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

tools/tox_install.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
# Client constraint file contains this client version pin that is in conflict
4+
# with installing the client from source. We should remove the version pin in
5+
# the constraints file before applying it for from-source installation.
6+
7+
CONSTRAINTS_FILE=$1
8+
shift 1
9+
10+
set -e
11+
12+
# NOTE(tonyb): Place this in the tox enviroment's log dir so it will get
13+
# published to logs.openstack.org for easy debugging.
14+
localfile="$VIRTUAL_ENV/log/upper-constraints.txt"
15+
16+
if [[ $CONSTRAINTS_FILE != http* ]]; then
17+
CONSTRAINTS_FILE=file://$CONSTRAINTS_FILE
18+
fi
19+
# NOTE(tonyb): need to add curl to bindep.txt if the project supports bindep
20+
curl $CONSTRAINTS_FILE --insecure --progress-bar --output $localfile
21+
22+
pip install -c$localfile openstack-requirements
23+
24+
# This is the main purpose of the script: Allow local installation of
25+
# the current repo. It is listed in constraints file and thus any
26+
# install will be constrained and we need to unconstrain it.
27+
edit-constraints $localfile -- $CLIENT_NAME
28+
29+
pip install -c$localfile -U $*
30+
exit $?

tox.ini

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
# noted to use py34 you need virtualenv >= 1.11.4
22
[tox]
33
envlist = py35,py34,py27,pypy,pep8,docs
4-
minversion = 1.6
4+
minversion = 2.0
55
skipsdist = True
66

77
[testenv]
88
usedevelop = True
99
# tox is silly... these need to be separated by a newline....
1010
whitelist_externals = find
1111
bash
12-
install_command = pip install -U {opts} {packages}
12+
passenv = ZUUL_CACHE_DIR
13+
REQUIREMENTS_PIP_LOCATION
14+
install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
1315
setenv = VIRTUAL_ENV={envdir}
16+
BRANCH_NAME=master
17+
CLIENT_NAME=python-novaclient
1418

15-
deps = -r{toxinidir}/requirements.txt
16-
-r{toxinidir}/test-requirements.txt
19+
deps = -r{toxinidir}/test-requirements.txt
1720
commands =
1821
find . -type f -name "*.pyc" -delete
1922
bash tools/pretty_tox.sh '{posargs}'
@@ -41,13 +44,15 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasen
4144
basepython = python2.7
4245
passenv = OS_NOVACLIENT_TEST_NETWORK
4346
setenv =
47+
{[testenv]setenv}
4448
OS_TEST_PATH = ./novaclient/tests/functional
4549
commands = bash tools/pretty_tox.sh '--concurrency=1 {posargs}'
4650

4751
[testenv:functional-py34]
4852
basepython = python3.4
4953
passenv = OS_NOVACLIENT_TEST_NETWORK
5054
setenv =
55+
{[testenv]setenv}
5156
OS_TEST_PATH = ./novaclient/tests/functional
5257
commands = bash tools/pretty_tox.sh '--concurrency=1 {posargs}'
5358

0 commit comments

Comments
 (0)