Automatically select python version on scenario and fucntional tests

Change-Id: I6da8e7fd15f913758c562bcc5aa7baca6a9692a2
This commit is contained in:
Federico Ressi 2019-05-27 04:54:26 +02:00
parent 4a1388c546
commit a880634a6f
4 changed files with 25 additions and 4 deletions

View File

@ -1,3 +1,3 @@
tox_dir: /opt/stack/tobiko
tox_envlist: neutron
tox_envlist: scenario
tox_extra_args: ''

View File

@ -1,5 +1,5 @@
- name: Run Tobiko
command: tox -e {{tox_envlist}} {{tox_extra_args}}
command: tools/ci/tox -e {{tox_envlist}} {{tox_extra_args}}
args:
chdir: "{{tox_dir}}"
become: true

23
tools/ci/tox Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
set -eux
# Prefer python3 on python2
PYTHON=$(which python3 || which python)
# Create a virtualenv for executing Tox and activate it
BASE_VIRTUALENV_DIR=.tox/base
if ! [ -d "${BASE_VIRTUALENV_DIR}" ]; then
"${PYTHON}" -m virtualenv "${BASE_VIRTUALENV_DIR}"
set +eux
source "${BASE_VIRTUALENV_DIR}/bin/activate"
set -eux
curl https://bootstrap.pypa.io/get-pip.py | python
pip install --upgrade setuptools wheel virtualenv tox
else
set +eux
source "${BASE_VIRTUALENV_DIR}/bin/activate"
set -eux
fi
tox "$*"

View File

@ -38,7 +38,6 @@ commands = {[base]commands}
[testenv:cover]
basepython = python3
setenv =
{[testenv]setenv}
PYTHON=coverage run --parallel-mode
@ -106,7 +105,6 @@ commands = {[base]commands}
[testenv:functional]
basepython = python3
deps = {[openstack]deps}
passenv = {[openstack]passenv}
setenv = {[openstack]setenv}