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
- openstack-cover-jobs
- openstack-lower-constraints-jobs
- openstack-python-jobs
- openstack-python3-train-jobs
- lib-forward-testing
- openstack-python3-ussuri-jobs
- lib-forward-testing-python3
- release-notes-jobs-python3
check:
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,
# but it is limited to 2h there and we want to set
# for it 3h timeout
@ -23,11 +16,6 @@
timeout: 10800
gate:
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,
# but it is limited to 2h there and we want to set
# for it 3h timeout

View File

@ -179,13 +179,7 @@ def safe_decode_utf8(s):
return s
try:
# PY3
weak_method = weakref.WeakMethod
except AttributeError:
# PY2
import weakrefmethod
weak_method = weakrefmethod.WeakMethod
weak_method = weakref.WeakMethod
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
setproctitle>=1.1.10 # BSD
WebOb>=1.7.1 # MIT
weakrefmethod>=1.0.2;python_version=='2.7' # PSF
os-traits>=0.9.0 # Apache-2.0

View File

@ -6,6 +6,7 @@ description-file =
author = OpenStack
author-email = openstack-discuss@lists.openstack.org
home-page = https://docs.openstack.org/neutron-lib/latest/
python-requires = >=3.6
classifier =
Environment :: OpenStack
Intended Audience :: Information Technology
@ -13,8 +14,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
@ -42,6 +41,3 @@ input_file = neutron_lib/locale/neutron_lib.pot
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = neutron_lib/locale/neutron_lib.pot
[wheel]
universal = 1

14
tox.ini
View File

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