Drop Python 2 support

This has bit-rotted as libraries have updated to Python 3 only.

Switch to hacking; some minor changes to regex-strings is all that is
required.

Drop py27 markers and move to Python 3 only.  Update requirements.

Depends-On: https://review.opendev.org/737666
Change-Id: Iabf201965129b3284166e1aedcb9f1c9d6109077
This commit is contained in:
Ian Wienand 2020-06-24 11:52:23 +10:00
parent ad1e1e3537
commit 878b20898d
8 changed files with 20 additions and 31 deletions

View File

@ -15,12 +15,12 @@ classifier =
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 2.6
Programming Language :: Python :: 3
Programming Language :: Python :: 3.3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Topic :: Utilities
[files]

View File

@ -16,14 +16,6 @@
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(
setup_requires=['pbr>=1.3'],
pbr=True)

View File

@ -2,12 +2,12 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking<0.11,>=0.10.0
flake8
coverage>=3.6
python-subunit>=0.0.18
requests-mock>=0.6.0
sphinx>=1.6.2
sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2 # BSD
mock>=1.2
openstackdocstheme>=1.11.0 # Apache-2.0
oslotest>=1.2.0 # Apache-2.0

View File

@ -23,9 +23,9 @@ class TestCaseDelete(TestCase):
def test_delete_without_path(self):
required = [
'.*?^usage: grafana-dashboards delete \[-h\] path',
'.*?^grafana-dashboards delete: error: (too few arguments|the '
'following arguments are required: path)',
r'.*?^usage: grafana-dashboards delete \[-h\] path',
r'.*?^grafana-dashboards delete: error: (too few arguments|the '
r'following arguments are required: path)',
]
stdout, stderr = self.shell('delete', exitcodes=[2])
for r in required:

View File

@ -23,9 +23,9 @@ class TestCaseUpdate(TestCase):
def test_update_without_path(self):
required = [
'.*?^usage: grafana-dashboards update \[-h\] path',
'.*?^grafana-dashboards update: error: (too few arguments|the '
'following arguments are required: path)',
r'.*?^usage: grafana-dashboards update \[-h\] path',
r'.*?^grafana-dashboards update: error: (too few arguments|the '
r'following arguments are required: path)',
]
stdout, stderr = self.shell('update', exitcodes=[2])
for r in required:

View File

@ -102,7 +102,7 @@ class TestCaseValidate(TestCase):
def _validate_invalid_file_or_directory(self, path):
required = [
'%s: ERROR: \[Errno 2\] No such file or directory:' % path,
r'%s: ERROR: \[Errno 2\] No such file or directory:' % path,
]
stdout, stderr = self.shell(
'validate %s' % path, exitcodes=[1])
@ -113,9 +113,9 @@ class TestCaseValidate(TestCase):
def test_validate_without_path(self):
required = [
'.*?^usage: grafana-dashboards validate \[-h\] path',
'.*?^grafana-dashboards validate: error: (too few arguments|the '
'following arguments are required: path)',
r'.*?^usage: grafana-dashboards validate \[-h\] path',
r'.*?^grafana-dashboards validate: error: (too few arguments|the '
r'following arguments are required: path)',
]
stdout, stderr = self.shell('validate', exitcodes=[2])
for r in required:

View File

@ -23,4 +23,4 @@ class TestCaseVersion(TestCase):
stdout, stderr = self.shell('--version')
self.assertThat(
(stdout + stderr),
matchers.MatchesRegex('.*?^(\d+)\.(\d+)\.(\d+)'))
matchers.MatchesRegex(r'.*?^(\d+)\.(\d+)\.(\d+)'))

11
tox.ini
View File

@ -1,7 +1,8 @@
[tox]
minversion = 1.6
envlist = docs,pep8,py27,py35
minversion = 3.1.1
envlist = docs,pep8,py35,py36,py37,py38
skipsdist = True
ignore_basepython_conflict = True
[testenv]
usedevelop = True
@ -13,22 +14,18 @@ deps = -r{toxinidir}/requirements.txt
commands = python setup.py test --slowest --testr-args='{posargs}'
[testenv:pep8]
basepython = python3
commands = flake8
[testenv:venv]
basepython = python3
commands = {posargs}
[testenv:cover]
basepython = python3
commands =
coverage erase
python setup.py test --coverage --coverage-package-name=grafana_dashboards --testr-args='{posargs}'
coverage report
[testenv:docs]
basepython = python3
commands = python setup.py build_sphinx
[flake8]
@ -36,6 +33,6 @@ commands = python setup.py build_sphinx
# H202 skip until we actually write our own exceptions
show-source = True
ignore = E123,E125,H202
ignore = E123,E125,H202,W503
builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build