Remove Python 2 support from testing and gate jobs

tox:
- bumped tox minversion to 3.1.0 to get 'ignore_basepython_conflict'
- tox 'ignore_basepython_conflict' allows us to factor basepython=
  python3 to the [testenv] but override it when using '-e py37'
  (that way you actually get python 3.7 instead of whatever the system
  has for python3)
gate:
- adjusted tempest-dsvm-lvm-lio-barbican to use python 3 for devstack
- removed openstack-python-jobs template as these tests are covered
  in py3 by openstack-python3-ussuri-jobs
- dropped integrated-gate template as these tests are covered by the
  integrated-gate-storage template, which is already python3
- dropped tempest-full jobs as these are covered in py3 by tempest-
  integrated-storage
- changed openstack-tox-functional to openstack-tox-functional-py37
  and made it voting

The legacy-grenade-dsvm-cinder-mn-sub-* jobs are converted to py3
in a different patch, https://review.opendev.org/#/c/695787/

Left py2 requirements and did not adjust setup.cfg to require py3.
This prevents breakage for any projects still installing cinder under
py2.  These can be changed by a follow up patch in January.

Co-authored-by: Sean McGinnis <sean.mcginnis@gmail.com>
Co-authored-by: Brian Rosmaita <rosmaita.fossdev@gmail.com>

Closes-bug: #1853372

Change-Id: I376bd708ecc864f29c35b7225f875bb20a98cd3c
This commit is contained in:
Brian Rosmaita 2019-11-20 17:46:09 -05:00
parent 0e9112d42e
commit c93000b2cd
5 changed files with 16 additions and 32 deletions

View File

@ -1,12 +1,10 @@
- project:
templates:
- openstack-lower-constraints-jobs
- openstack-python-jobs
- openstack-python3-ussuri-jobs
- publish-openstack-docs-pti
- periodic-stable-jobs
- check-requirements
- integrated-gate
- integrated-gate-storage
- release-notes-jobs-python3
check:
@ -24,6 +22,8 @@
- ^contrib/block-box.*$
- ^doc/.*$
- ^releasenotes/.*$
- openstack-tox-functional-py37:
irrelevant-files: *functional-irrelevant-files
- cinder-rally-task:
voting: false
- openstack-tox-pylint:
@ -48,9 +48,6 @@
- ^setup.cfg$
- ^tools/.*$
- ^tox.ini$
- openstack-tox-functional:
voting: false
irrelevant-files: *functional-irrelevant-files
- legacy-grenade-dsvm-cinder-mn-sub-volbak:
irrelevant-files: *gate-irrelevant-files
- legacy-tempest-dsvm-lvm-multibackend:
@ -61,8 +58,6 @@
irrelevant-files: *gate-irrelevant-files
- tempest-slow-py3:
irrelevant-files: *gate-irrelevant-files
- tempest-full:
irrelevant-files: *gate-irrelevant-files
- tempest-integrated-storage:
irrelevant-files: *gate-irrelevant-files
- grenade-py3:
@ -73,8 +68,6 @@
jobs:
- legacy-grenade-dsvm-cinder-mn-sub-volbak:
irrelevant-files: *gate-irrelevant-files
- tempest-full:
irrelevant-files: *gate-irrelevant-files
- tempest-integrated-storage:
irrelevant-files: *gate-irrelevant-files
- grenade-py3:

View File

@ -54,6 +54,7 @@
# pip for stable branches.
export DEVSTACK_PROJECT_FROM_GIT=os-brick
fi
export DEVSTACK_GATE_USE_PYTHON3=True
export DEVSTACK_GATE_TEMPEST=1
export DEVSTACK_GATE_TEMPEST_ALL_PLUGINS=1
# As we are setting DEVSTACK_GATE_TEMPEST_ALL_PLUGINS, we need to add

View File

@ -0,0 +1,6 @@
---
upgrade:
- |
Python 2.7 support has been dropped. The last release of Cinder to support
py2.7 is OpenStack Train. The minimum version of Python now supported by
Cinder is Python 3.6.

View File

@ -13,8 +13,6 @@ classifier =
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7

28
tox.ini
View File

@ -1,10 +1,15 @@
[tox]
minversion = 2.5
minversion = 3.1.0
skipsdist = True
skip_missing_interpreters = true
envlist = py37,py27,compliance,pep8
# python runtimes: https://governance.openstack.org/tc/reference/runtimes/ussuri.html
envlist = py37,py36,compliance,pep8
# this allows tox to infer the base python from the environment name
# and override any basepython configured in this file
ignore_basepython_conflict=true
[testenv]
basepython = python3
setenv = VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
OS_STDOUT_CAPTURE=1
@ -33,7 +38,6 @@ whitelist_externals =
passenv = *_proxy *_PROXY
[testenv:api-ref]
basepython = python3
whitelist_externals = rm
deps = {[testenv:docs]deps}
commands =
@ -41,7 +45,6 @@ commands =
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html/
[testenv:releasenotes]
basepython = python3
deps = {[testenv:docs]deps}
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
@ -68,12 +71,10 @@ commands =
stestr slowest
[testenv:compliance]
basepython = python3
setenv =
OS_TEST_PATH = ./cinder/tests/compliance
[testenv:pep8]
basepython = python3
commands =
flake8 {posargs} .
doc8
@ -81,7 +82,6 @@ commands =
{toxinidir}/tools/check_exec.py {toxinidir}/cinder {toxinidir}/doc/source/ {toxinidir}/releasenotes/notes
[testenv:fast8]
basepython = python3
# Use same environment directory as pep8 env to save space and install time
envdir = {toxworkdir}/pep8
commands =
@ -89,7 +89,6 @@ commands =
passenv = FAST8_NUM_COMMITS
[testenv:pylint]
basepython = python3
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
pylint==2.3.0
@ -99,7 +98,6 @@ commands =
[testenv:cover]
# Also do not run test_coverage_ext tests while gathering coverage as those
# tests conflict with coverage.
basepython = python3
setenv =
{[testenv]setenv}
PYTHON=coverage run --source cinder --parallel-mode
@ -110,28 +108,23 @@ commands =
coverage xml -o cover/coverage.xml
[testenv:genconfig]
basepython = python3
sitepackages = False
envdir = {toxworkdir}/pep8
commands = oslo-config-generator --config-file=tools/config/cinder-config-generator.conf
[testenv:genpolicy]
basepython = python3
commands = oslopolicy-sample-generator --config-file=tools/config/cinder-policy-generator.conf
[testenv:genopts]
basepython = python3
sitepackages = False
envdir = {toxworkdir}/pep8
commands = python tools/config/generate_cinder_opts.py
[testenv:venv]
basepython = python3
commands = {posargs}
[testenv:docs]
basepython = python3
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
@ -142,7 +135,6 @@ commands =
whitelist_externals = rm
[testenv:pdf-docs]
basepython = python3
deps = {[testenv:docs]deps}
commands =
rm -fr doc/source/contributor/api/
@ -154,18 +146,15 @@ whitelist_externals =
rm
[testenv:gendriverlist]
basepython = python3
sitepackages = False
envdir = {toxworkdir}/venv
commands = python {toxinidir}/tools/generate_driver_list.py
[testenv:bandit]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands = bandit -r cinder -n5 -x cinder/tests/* -ll
[testenv:bandit-baseline]
basepython = python3
envdir = {toxworkdir}/bandit
commands = bandit-baseline -r cinder -n5 -x cinder/tests/* -ii -ll
@ -176,7 +165,6 @@ commands = bandit-baseline -r cinder -n5 -x cinder/tests/* -ii -ll
# separately, outside of the requirements files, and develop mode disabled
# explicitly to avoid unnecessarily installing the checked-out repo too (this
# further relies on "tox.skipsdist = True" above).
basepython = python3
deps = bindep
commands = bindep test
usedevelop = False
@ -211,12 +199,10 @@ local-check-factory = cinder.tests.hacking.checks.factory
import_exceptions = cinder.i18n
[doc8]
ignore-path=.tox,*.egg-info,doc/src/api,doc/source/drivers.rst,doc/build,.eggs/*/EGG-INFO/*.txt,doc/source/configuration/tables,./*.txt
extension=.txt,.rst,.inc
[testenv:lower-constraints]
basepython = python3
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt