Drop Python 2.7 support

Python 2.7 is deprecated now, and some dependencies have dropped their
support for it. We should also just drop support for it rather than
pinning the dependency versions.

This commit also switches to a generic Python 3 tox environment,
adds additional test jobs for more Python 3 versions, and cleans up
some Python 2 compatibility cruft.

Change-Id: I3e7cc1713dec1bada4a85f75362c4fa4f89ceae6
This commit is contained in:
Adam Coldrick 2020-03-27 16:38:59 +00:00 committed by Jeremy Stanley
parent a0e274507c
commit 647bb9c660
6 changed files with 22 additions and 38 deletions

View File

@ -87,20 +87,24 @@
timeout: 6000 timeout: 6000
- storyboard-tox-sqlite - storyboard-tox-sqlite
- tox-pep8 - tox-pep8
- tox-py27:
timeout: 6000
- tox-py36: - tox-py36:
timeout: 6000 timeout: 6000
- tox-py37:
timeout: 6000
- tox-py38:
timeout: 6000
- opendev-buildset-registry - opendev-buildset-registry
- storyboard-build-opendev-image - storyboard-build-opendev-image
gate: gate:
jobs: jobs:
- storyboard-tox-sqlite - storyboard-tox-sqlite
- tox-pep8 - tox-pep8
- tox-py27:
timeout: 6000
- tox-py36: - tox-py36:
timeout: 6000 timeout: 6000
- tox-py37:
timeout: 6000
- tox-py38:
timeout: 6000
- opendev-buildset-registry - opendev-buildset-registry
- storyboard-upload-opendev-image - storyboard-upload-opendev-image
post: post:

View File

@ -81,10 +81,10 @@ And to run the style-checker and static analysis tool::
$ tox -e pep8 $ tox -e pep8
If you would like to run the test suite with proper database backends or If you would like to run the test suite with proper database backends
with python2 instead of python3 there is one more step to follow. Note there is one more step to follow. Note that the testsuite takes quite
that the testsuite takes quite a bit longer to run when using the MySQL a bit longer to run when using the MySQL and PostgreSQL database
and PostgreSQL database backends. backends.
First ensure MySQL and PostgreSQL are running (you may need to start First ensure MySQL and PostgreSQL are running (you may need to start
these services). Then run the test-setup.sh helper script:: these services). Then run the test-setup.sh helper script::
@ -95,18 +95,14 @@ This script needs to be run with a user that has sudo access. It will
configure the databases as needed to run the unittests. You can then configure the databases as needed to run the unittests. You can then
runt the unittests with:: runt the unittests with::
$ tox -e py27 $ tox -e py3
or for Python 3::
$ tox -e py35
On slower systems, the database migrations may take longer than the On slower systems, the database migrations may take longer than the
default timeout of 120 seconds. To override the timeout, set the default timeout of 120 seconds. To override the timeout, set the
``OS_TEST_TIMEOUT`` environment variable. For example, to set the ``OS_TEST_TIMEOUT`` environment variable. For example, to set the
timeout to 3 minutes, run:: timeout to 3 minutes, run::
$ OS_TEST_TIMEOUT=180 tox -e py27 $ OS_TEST_TIMEOUT=180 tox -e py3
For More Extensive Testing... For More Extensive Testing...
------------------------------- -------------------------------

View File

@ -11,8 +11,7 @@ pecan>=0.4.5
oslo.db>=4.27.0 # Apache-2.0 oslo.db>=4.27.0 # Apache-2.0
oslo.log>=1.0.0 oslo.log>=1.0.0
pika>=0.9.14 pika>=0.9.14
python-openid ; python_version < '3.0' python3-openid
python3-openid ; python_version >= '3.0'
PyYAML>=3.1.0 PyYAML>=3.1.0
requests>=1.1 requests>=1.1
six>=1.7.0 six>=1.7.0
@ -22,7 +21,6 @@ WSME>=0.6,<0.8
SQLAlchemy-FullText-Search>=0.2.3 SQLAlchemy-FullText-Search>=0.2.3
stevedore>=1.3.0 stevedore>=1.3.0
tzlocal>=1.1.2 tzlocal>=1.1.2
email>=4.0.2;python_version<'3.0'
Jinja2>=2.7.3 Jinja2>=2.7.3
PyMySQL>=0.6.2,!=0.6.4 PyMySQL>=0.6.2,!=0.6.4
apscheduler>=3.0.1,<3.1.0 apscheduler>=3.0.1,<3.1.0

View File

@ -12,6 +12,7 @@ project_urls =
Bug Reporting = https://storyboard.openstack.org/#!/project/opendev/storyboard Bug Reporting = https://storyboard.openstack.org/#!/project/opendev/storyboard
Documentation = https://docs.openstack.org/infra/storyboard Documentation = https://docs.openstack.org/infra/storyboard
Git Clone URL = https://opendev.org/opendev/storyboard Git Clone URL = https://opendev.org/opendev/storyboard
python_requires = >=3.6
classifier = classifier =
Environment :: Web Environment Environment :: Web Environment
Intended Audience :: Developers Intended Audience :: Developers
@ -21,9 +22,11 @@ classifier =
Operating System :: OS Independent Operating System :: OS Independent
Operating System :: POSIX :: Linux Operating System :: POSIX :: Linux
Programming Language :: Python Programming Language :: Python
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3 Programming Language :: Python :: 3
Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3 :: Only
Topic :: Software Development :: Bug Tracking Topic :: Software Development :: Bug Tracking
[files] [files]
@ -49,9 +52,6 @@ storyboard.plugin.user_preferences =
storyboard.plugin.scheduler = storyboard.plugin.scheduler =
token-cleaner = storyboard.plugin.token_cleaner.cleaner:TokenCleaner token-cleaner = storyboard.plugin.token_cleaner.cleaner:TokenCleaner
[wheel]
universal = 1
[build_sphinx] [build_sphinx]
warning-is-error = 1 warning-is-error = 1
source-dir = doc/source source-dir = doc/source

View File

@ -16,14 +16,6 @@
# This file was pulled from the openstack global requirements repo. # This file was pulled from the openstack global requirements repo.
import setuptools import setuptools
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup( setuptools.setup(
setup_requires=['pbr>=5'], setup_requires=['pbr>=5'],
pbr=True) pbr=True)

10
tox.ini
View File

@ -1,9 +1,10 @@
[tox] [tox]
minversion = 2.9.1 minversion = 2.9.1
skipsdist = True skipsdist = True
envlist = py35,py27,pep8 envlist = py3,pep8
[testenv] [testenv]
basepython = python3
usedevelop = True usedevelop = True
install_command = pip install -U {opts} {packages} install_command = pip install -U {opts} {packages}
passenv = OS_* STORYBOARD_* passenv = OS_* STORYBOARD_*
@ -19,21 +20,17 @@ commands = stestr run {posargs}
whitelist_externals = bash whitelist_externals = bash
[testenv:sqlite] [testenv:sqlite]
basepython = python3
setenv = setenv =
{[testenv]setenv} {[testenv]setenv}
STORYBOARD_TEST_DB=sqlite:///{envtmpdir} STORYBOARD_TEST_DB=sqlite:///{envtmpdir}
[testenv:pep8] [testenv:pep8]
basepython = python3
commands = flake8 commands = flake8
[testenv:venv] [testenv:venv]
basepython = python3
commands = {posargs} commands = {posargs}
[testenv:docs] [testenv:docs]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt deps = -r{toxinidir}/doc/requirements.txt
commands = commands =
rm -rf doc/html doc/build rm -rf doc/html doc/build
@ -42,7 +39,6 @@ commands =
whitelist_externals = rm whitelist_externals = rm
[testenv:cover] [testenv:cover]
basepython = python3
setenv = setenv =
{[testenv]setenv} {[testenv]setenv}
PYTHON=coverage run --source storyboard --parallel-mode PYTHON=coverage run --source storyboard --parallel-mode
@ -64,7 +60,6 @@ show-source = True
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
[testenv:bindep] [testenv:bindep]
basepython = python3
# Do not install any requirements. We want this to be fast and work even if # Do not install any requirements. We want this to be fast and work even if
# system dependencies are missing, since it's used to tell you what system # system dependencies are missing, since it's used to tell you what system
# dependencies are missing! This also means that bindep must be installed # dependencies are missing! This also means that bindep must be installed
@ -73,7 +68,6 @@ deps = bindep
commands = bindep test commands = bindep test
[testenv:lpimport] [testenv:lpimport]
basepython = python3
# The Launchpad bug import tool uses launchpadlib, which is not a typical # The Launchpad bug import tool uses launchpadlib, which is not a typical
# runtime dependency of anything else in StoryBoard # runtime dependency of anything else in StoryBoard
deps = launchpadlib deps = launchpadlib