Default tox jobs to python3

The long term goal for OpenStack is to support python3 for
all things except explicit python2 testing by the T release.
Part of preparing for that is ensuring all ancillary things
like docs jobs and other tooling work with python3.

This switches the default for our docs jobs to python3 so
anything that does not specify another version will end up
using it.

Further work is necessary for the pylint job due to changes
between the runtimes. That will be done in a follow up patch.

There was also a difference in behavior with the genopts job
where it ends up trying to recreate the venv under which it
is currently running under, resulting in a corrupted venv
and a failure. This cleans up that script and changes it so
rather than a tox job calling a tox job it just runs the
script.

Change-Id: Ie79528b33070e6c60f9f5e1f2219084a2f0cb039
This commit is contained in:
Sean McGinnis 2018-06-05 14:16:34 -05:00
parent 9d263f711d
commit 37510ac034
2 changed files with 52 additions and 34 deletions

View File

@ -1,35 +1,55 @@
#!/usr/bin/env bash
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# This script is used to check if there have been configuration changes that
# have not been checked in.
# The opts file needs to be present in order to compare it
if [ ! -e cinder/opts.py ]; then
echo -en "\n\n#################################################"
echo -en "\nERROR: cinder/opts.py file is missing."
echo -en "\n#################################################\n"
echo ""
echo "#################################################"
echo "ERROR: cinder/opts.py file is missing."
echo "#################################################"
exit 1
else
mv cinder/opts.py cinder/opts.py.orig
tox -e genopts &> tox-genops.log
if [ $? -ne 0 ]; then
cat tox-genops.log >&2
echo -en "\n\n#################################################"
echo -en "\nERROR: Non-zero exit from generate_cinder_opts.py."
echo -en "\n See output above for details.\n"
echo -en "#################################################\n"
mv cinder/opts.py.orig cinder/opts.py
exit 1
else
diff cinder/opts.py.orig cinder/opts.py
if [ $? -ne 0 ]; then
echo -en "\n\n########################################################"
echo -en "\nERROR: Configuration options change detected."
echo -en "\n A new cinder/opts.py file must be generated."
echo -en "\n Run 'tox -e genopts' from the base directory"
echo -en "\n and add the result to your commit."
echo -en "\n########################################################\n\n"
rm cinder/opts.py
mv cinder/opts.py.orig cinder/opts.py
exit 1
else
rm cinder/opts.py.orig
fi
fi
fi
# Rename the existing file so we can generate a new one to compare
mv cinder/opts.py cinder/opts.py.orig
python tools/config/generate_cinder_opts.py &> tox-genops.log
if [ $? -ne 0 ]; then
cat tox-genops.log >&2
echo ""
echo "#################################################"
echo "ERROR: Non-zero exit from generate_cinder_opts.py."
echo " See output above for details."
echo "#################################################"
mv cinder/opts.py.orig cinder/opts.py
exit 1
fi
diff cinder/opts.py.orig cinder/opts.py
if [ $? -ne 0 ]; then
echo ""
echo "########################################################"
echo "ERROR: Configuration options change detected."
echo " A new cinder/opts.py file must be generated."
echo " Run 'tox -e genopts' from the base directory"
echo " and add the result to your commit."
echo "########################################################"
rm cinder/opts.py
mv cinder/opts.py.orig cinder/opts.py
exit 1
fi
rm cinder/opts.py.orig

View File

@ -4,6 +4,7 @@ skipsdist = True
envlist = py35,py27,compliance,pep8
[testenv]
basepython = python3
setenv = VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
OS_STDOUT_CAPTURE=1
@ -56,7 +57,6 @@ setenv =
{[testenv:functional]setenv}
[testenv:functional-py36]
basepython = python3
setenv =
{[testenv:functional]setenv}
@ -65,7 +65,6 @@ setenv =
OS_TEST_PATH = ./cinder/tests/compliance
[testenv:pep8]
basepython = python3
commands =
flake8 {posargs} .
{toxinidir}/tools/config/check_uptodate.sh
@ -74,11 +73,11 @@ commands =
[testenv:fast8]
# Use same environment directory as pep8 env to save space and install time
envdir = {toxworkdir}/pep8
basepython = python3
commands =
{toxinidir}/tools/fast8.sh
[testenv:pylint]
basepython = python2.7
deps = -r{toxinidir}/requirements.txt
pylint==0.26.0
commands = bash tools/lintstack.sh
@ -165,7 +164,6 @@ local-check-factory = cinder.hacking.checks.factory
import_exceptions = cinder.i18n
[testenv:lower-constraints]
basepython = python3
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt