diff --git a/roles/run-tox/defaults/main.yaml b/roles/run-tox/defaults/main.yaml index 47a02d3d2..9cbcb4b27 100644 --- a/roles/run-tox/defaults/main.yaml +++ b/roles/run-tox/defaults/main.yaml @@ -1,3 +1,3 @@ tox_dir: /opt/stack/tobiko -tox_envlist: neutron +tox_envlist: scenario tox_extra_args: '' diff --git a/roles/run-tox/tasks/main.yaml b/roles/run-tox/tasks/main.yaml index 0d22f0403..32a555850 100644 --- a/roles/run-tox/tasks/main.yaml +++ b/roles/run-tox/tasks/main.yaml @@ -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 diff --git a/tools/ci/tox b/tools/ci/tox new file mode 100755 index 000000000..b26e314ff --- /dev/null +++ b/tools/ci/tox @@ -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 "$*" diff --git a/tox.ini b/tox.ini index 45f57c9de..151c9be44 100644 --- a/tox.ini +++ b/tox.ini @@ -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}