Browse Source

Removes py26 support

We are removing Python 2.6 support from the Keystone libraries.

Change-Id: I1c7a79edd41a73946c9d77bfb8cd2075e2500760
Closes-Bug: 1519449
changes/94/249494/1
David Stanek 6 years ago
parent
commit
f4e6f12a71
  1. 6
      keystoneclient/__init__.py
  2. 8
      keystoneclient/common/cms.py
  3. 7
      keystoneclient/tests/unit/v2_0/test_auth.py
  4. 8
      keystoneclient/tests/unit/v3/test_auth.py
  5. 1
      setup.cfg
  6. 2
      tox.ini

6
keystoneclient/__init__.py

@ -27,6 +27,7 @@ Identity V2 and V3 clients can also be created directly. See
"""
import importlib
import sys
import pbr.version
@ -67,10 +68,9 @@ class _LazyImporter(object):
'v2_0',
'v3',
]
# __import__ rather than importlib for Python 2.6.
if name in lazy_submodules:
__import__('keystoneclient.%s' % name)
return getattr(self, name)
return importlib.import_module('keystoneclient.%s' % name)
# Return module attributes like __all__ etc.
return getattr(self._module, name)

8
keystoneclient/common/cms.py

@ -101,7 +101,7 @@ def _process_communicate_handle_oserror(process, data, files):
except OSError as e:
if e.errno != errno.EPIPE:
raise
# OSError with EPIPE only occurs with Python 2.6.x/old 2.7.x
# OSError with EPIPE only occurs with old Python 2.7.x versions
# http://bugs.python.org/issue10963
# The quick exit is typically caused by the openssl command not being
@ -191,11 +191,7 @@ def cms_verify(formatted, signing_cert_file_name, ca_file_name,
else:
raise exceptions.CertificateConfigError(err)
elif retcode != OpensslCmsExitStatus.SUCCESS:
# NOTE(dmllr): Python 2.6 compatibility:
# CalledProcessError did not have output keyword argument
e = subprocess.CalledProcessError(retcode, 'openssl')
e.output = err
raise e
raise subprocess.CalledProcessError(retcode, 'openssl', output=err)
return output

7
keystoneclient/tests/unit/v2_0/test_auth.py

@ -15,6 +15,7 @@ import datetime
from oslo_serialization import jsonutils
from oslo_utils import timeutils
from testtools import testcase
from keystoneclient import exceptions
from keystoneclient.tests.unit.v2_0 import utils
@ -91,17 +92,13 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_auth(status_code=401, json=error)
# Workaround for issue with assertRaises on python2.6
# where with assertRaises(exceptions.Unauthorized): doesn't work
# right
def client_create_wrapper():
with testcase.ExpectedException(exceptions.Unauthorized):
with self.deprecations.expect_deprecations_here():
client.Client(username=self.TEST_USER,
password="bad_key",
project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL)
self.assertRaises(exceptions.Unauthorized, client_create_wrapper)
self.assertRequestBodyIs(json=self.TEST_REQUEST_BODY)
def test_auth_redirect(self):

8
keystoneclient/tests/unit/v3/test_auth.py

@ -11,6 +11,7 @@
# under the License.
from oslo_serialization import jsonutils
from testtools import testcase
from keystoneclient import exceptions
from keystoneclient.tests.unit.v3 import utils
@ -103,11 +104,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_auth(status_code=401, json=error)
# Workaround for issue with assertRaises on python2.6
# where with assertRaises(exceptions.Unauthorized): doesn't work
# right
def client_create_wrapper():
# Creating a HTTPClient not using session is deprecated.
with testcase.ExpectedException(exceptions.Unauthorized):
with self.deprecations.expect_deprecations_here():
client.Client(user_domain_name=self.TEST_DOMAIN_NAME,
username=self.TEST_USER,
@ -115,7 +112,6 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL)
self.assertRaises(exceptions.Unauthorized, client_create_wrapper)
self.assertRequestBodyIs(json=self.TEST_REQUEST_BODY)
def test_auth_redirect(self):

1
setup.cfg

@ -15,7 +15,6 @@ classifier =
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.4

2
tox.ini

@ -1,7 +1,7 @@
[tox]
minversion = 1.6
skipsdist = True
envlist = py26,py27,py34,pep8,bandit
envlist = py27,py34,pep8,bandit
[testenv]
usedevelop = True

Loading…
Cancel
Save