Stop testing Python 2

This change removes the requirement for python 2 and removes testing for
it, but tries to leave the code compatible with python2 where possible.

Co-Authored-By: Nate Johnston <nate.johnston@redhat.com>
Change-Id: I711ae939b5eaa1816af15b22527c38858507127f
This commit is contained in:
zhanghao 2019-11-20 03:54:29 -05:00 committed by Nate Johnston
parent 7e95f32e34
commit d9a0ce5d72
6 changed files with 10 additions and 38 deletions

View File

@ -4,18 +4,11 @@
- publish-openstack-docs-pti - publish-openstack-docs-pti
- openstack-cover-jobs - openstack-cover-jobs
- openstack-lower-constraints-jobs - openstack-lower-constraints-jobs
- openstack-python-jobs - openstack-python3-ussuri-jobs
- openstack-python3-train-jobs
- lib-forward-testing
- lib-forward-testing-python3 - lib-forward-testing-python3
- release-notes-jobs-python3 - release-notes-jobs-python3
check: check:
jobs: jobs:
# This job comes from lib-forward-testing template,
# but it is limited to 2h there and we want to set
# for it 3h timeout
- tempest-full:
timeout: 10800
# This job comes from lib-forward-testing-python3 template, # This job comes from lib-forward-testing-python3 template,
# but it is limited to 2h there and we want to set # but it is limited to 2h there and we want to set
# for it 3h timeout # for it 3h timeout
@ -23,11 +16,6 @@
timeout: 10800 timeout: 10800
gate: gate:
jobs: jobs:
# This job comes from lib-forward-testing template,
# but it is limited to 2h there and we want to set
# for it 3h timeout
- tempest-full:
timeout: 10800
# This job comes from lib-forward-testing-python3 template, # This job comes from lib-forward-testing-python3 template,
# but it is limited to 2h there and we want to set # but it is limited to 2h there and we want to set
# for it 3h timeout # for it 3h timeout

View File

@ -179,13 +179,7 @@ def safe_decode_utf8(s):
return s return s
try: weak_method = weakref.WeakMethod
# PY3
weak_method = weakref.WeakMethod
except AttributeError:
# PY2
import weakrefmethod
weak_method = weakrefmethod.WeakMethod
def make_weak_ref(f): def make_weak_ref(f):

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
Python 2.7 support has been dropped. The minimum version of Python now
supported by neutron-lib is Python 3.6.

View File

@ -26,6 +26,5 @@ oslo.versionedobjects>=1.31.2 # Apache-2.0
osprofiler>=1.4.0 # Apache-2.0 osprofiler>=1.4.0 # Apache-2.0
setproctitle>=1.1.10 # BSD setproctitle>=1.1.10 # BSD
WebOb>=1.7.1 # MIT WebOb>=1.7.1 # MIT
weakrefmethod>=1.0.2;python_version=='2.7' # PSF
os-traits>=0.9.0 # Apache-2.0 os-traits>=0.9.0 # Apache-2.0

View File

@ -6,6 +6,7 @@ description-file =
author = OpenStack author = OpenStack
author-email = openstack-discuss@lists.openstack.org author-email = openstack-discuss@lists.openstack.org
home-page = https://docs.openstack.org/neutron-lib/latest/ home-page = https://docs.openstack.org/neutron-lib/latest/
python-requires = >=3.6
classifier = classifier =
Environment :: OpenStack Environment :: OpenStack
Intended Audience :: Information Technology Intended Audience :: Information Technology
@ -13,8 +14,6 @@ classifier =
License :: OSI Approved :: Apache Software License License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux Operating System :: POSIX :: Linux
Programming Language :: Python Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3 Programming Language :: Python :: 3
Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.7
@ -42,6 +41,3 @@ input_file = neutron_lib/locale/neutron_lib.pot
keywords = _ gettext ngettext l_ lazy_gettext keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg mapping_file = babel.cfg
output_file = neutron_lib/locale/neutron_lib.pot output_file = neutron_lib/locale/neutron_lib.pot
[wheel]
universal = 1

14
tox.ini
View File

@ -1,7 +1,8 @@
[tox] [tox]
minversion = 2.3.2 minversion = 2.3.2
envlist = py27,py37,pep8 envlist = py37,pep8
skipsdist = True skipsdist = True
ignore_basepython_conflict = True
[testenv] [testenv]
usedevelop = True usedevelop = True
@ -20,14 +21,12 @@ commands =
stestr run {posargs} stestr run {posargs}
[testenv:pep8] [testenv:pep8]
basepython = python3
commands = commands =
flake8 flake8
{toxinidir}/tools/check_samples.sh {toxinidir}/tools/check_samples.sh
{[testenv:bandit]commands} {[testenv:bandit]commands}
[testenv:releasenotes] [testenv:releasenotes]
basepython = python3
deps = deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
@ -35,11 +34,9 @@ deps =
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:venv] [testenv:venv]
basepython = python3
commands = {posargs} commands = {posargs}
[testenv:cover] [testenv:cover]
basepython = python3
setenv = setenv =
{[testenv]setenv} {[testenv]setenv}
PYTHON=coverage run --source neutron_lib --parallel-mode PYTHON=coverage run --source neutron_lib --parallel-mode
@ -50,7 +47,6 @@ commands =
coverage xml -o cover/coverage.xml coverage xml -o cover/coverage.xml
[testenv:docs] [testenv:docs]
basepython = python3
deps = deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
@ -58,7 +54,6 @@ deps =
commands = sphinx-build -W -b html doc/source doc/build/html commands = sphinx-build -W -b html doc/source doc/build/html
[testenv:pdf-docs] [testenv:pdf-docs]
basepython = python3
envdir = {toxworkdir}/docs envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps} deps = {[testenv:docs]deps}
whitelist_externals = whitelist_externals =
@ -68,7 +63,6 @@ commands =
make -C doc/build/pdf make -C doc/build/pdf
[testenv:api-ref] [testenv:api-ref]
basepython = python3
whitelist_externals = rm whitelist_externals = rm
deps = deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
@ -79,7 +73,6 @@ commands =
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
[testenv:linkcheck] [testenv:linkcheck]
basepython = python3
deps = deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
@ -92,11 +85,9 @@ commands =
sphinx-build -W -b linkcheck doc/source doc/build/linkcheck sphinx-build -W -b linkcheck doc/source doc/build/linkcheck
[testenv:debug] [testenv:debug]
basepython = python3
commands = oslo_debug_helper -t neutron_lib/tests/unit {posargs} commands = oslo_debug_helper -t neutron_lib/tests/unit {posargs}
[testenv:api-report] [testenv:api-report]
basepython = python3
commands = commands =
{toxinidir}/tools/api_report.sh {toxinidir}/tools/api_report.sh
@ -123,7 +114,6 @@ import_exceptions = neutron_lib._i18n
local-check-factory = neutron_lib.hacking.checks._neutron_lib_factory local-check-factory = neutron_lib.hacking.checks._neutron_lib_factory
[testenv:lower-constraints] [testenv:lower-constraints]
basepython = python3
deps = deps =
-c{toxinidir}/lower-constraints.txt -c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt