Merge "Remove usage of six"
diff --git a/tempest/api/compute/servers/test_novnc.py b/tempest/api/compute/servers/test_novnc.py
index a9c0e56..1308b19 100644
--- a/tempest/api/compute/servers/test_novnc.py
+++ b/tempest/api/compute/servers/test_novnc.py
@@ -15,8 +15,6 @@
import struct
import urllib.parse as urlparse
-
-import six
import urllib3
from tempest.api.compute import base
@@ -122,7 +120,7 @@
'Expected authentication type None.')
# Send to the server that we only support authentication
# type None
- self._websocket.send_frame(six.int2byte(1))
+ self._websocket.send_frame(bytes((1,)))
# The server should send 4 bytes of 0's if security
# handshake succeeded
@@ -135,7 +133,7 @@
'Server did not think security was successful.')
# Say to leave the desktop as shared as part of client initialization
- self._websocket.send_frame(six.int2byte(1))
+ self._websocket.send_frame(bytes((1,)))
# Get the server initialization packet back and make sure it is the
# right structure where bytes 20-24 is the name length and
# 24-N is the name
diff --git a/tempest/api/identity/v2/test_tokens.py b/tempest/api/identity/v2/test_tokens.py
index a928ad9..d3776b8 100644
--- a/tempest/api/identity/v2/test_tokens.py
+++ b/tempest/api/identity/v2/test_tokens.py
@@ -14,7 +14,6 @@
# under the License.
from oslo_utils import timeutils
-import six
from tempest.api.identity import base
from tempest.lib import decorators
@@ -36,7 +35,7 @@
body = token_client.auth(username, password, tenant_name)
self.assertNotEmpty(body['token']['id'])
- self.assertIsInstance(body['token']['id'], six.string_types)
+ self.assertIsInstance(body['token']['id'], str)
now = timeutils.utcnow()
expires_at = timeutils.normalize_time(
diff --git a/tempest/api/identity/v3/test_tokens.py b/tempest/api/identity/v3/test_tokens.py
index b201285..55fcead 100644
--- a/tempest/api/identity/v3/test_tokens.py
+++ b/tempest/api/identity/v3/test_tokens.py
@@ -16,7 +16,6 @@
import operator
from oslo_utils import timeutils
-import six
from tempest.api.identity import base
from tempest.lib import decorators
@@ -88,7 +87,7 @@
auth_data=True)
self.assertNotEmpty(token_id)
- self.assertIsInstance(token_id, six.string_types)
+ self.assertIsInstance(token_id, str)
now = timeutils.utcnow()
expires_at = timeutils.normalize_time(
diff --git a/tempest/api/object_storage/test_account_services.py b/tempest/api/object_storage/test_account_services.py
index ffea6f6..4966ec4 100644
--- a/tempest/api/object_storage/test_account_services.py
+++ b/tempest/api/object_storage/test_account_services.py
@@ -14,8 +14,6 @@
# under the License.
import random
-
-import six
import testtools
from tempest.api.object_storage import base
@@ -43,7 +41,7 @@
def resource_setup(cls):
super(AccountTest, cls).resource_setup()
for i in range(ord('a'), ord('f') + 1):
- name = data_utils.rand_name(name='%s-' % six.int2byte(i))
+ name = data_utils.rand_name(name='%s-' % bytes((i,)))
cls.container_client.update_container(name)
cls.addClassResourceCleanup(base.delete_containers,
[name],
diff --git a/tempest/lib/common/api_version_utils.py b/tempest/lib/common/api_version_utils.py
index 80dbc1d..db5c8c3 100644
--- a/tempest/lib/common/api_version_utils.py
+++ b/tempest/lib/common/api_version_utils.py
@@ -12,7 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
import testtools
from tempest.lib.common import api_version_request
@@ -117,7 +116,7 @@
:param response_header: Response header where microversion is
expected to be present.
"""
- if not isinstance(api_microversion, six.string_types):
+ if not isinstance(api_microversion, str):
raise TypeError('api_microversion must be a string')
api_microversion_header_name = api_microversion_header_name.lower()
if (api_microversion_header_name not in response_header or
diff --git a/tempest/lib/common/http.py b/tempest/lib/common/http.py
index 8c1a802..33f871b 100644
--- a/tempest/lib/common/http.py
+++ b/tempest/lib/common/http.py
@@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
import urllib3
@@ -89,7 +88,7 @@
for key, value in info.getheaders().items():
# We assume HTTP header name to be string, not random
# bytes, thus ensure we have string keys.
- self[six.u(key).lower()] = value
+ self[str(key).lower()] = value
self.status = info.status
self['status'] = str(self.status)
self.reason = info.reason
diff --git a/tempest/lib/common/ssh.py b/tempest/lib/common/ssh.py
index 60107d7..ee15375 100644
--- a/tempest/lib/common/ssh.py
+++ b/tempest/lib/common/ssh.py
@@ -21,7 +21,6 @@
import warnings
from oslo_log import log as logging
-import six
from tempest.lib import exceptions
@@ -66,7 +65,7 @@
self.username = username
self.port = port
self.password = password
- if isinstance(pkey, six.string_types):
+ if isinstance(pkey, str):
pkey = paramiko.RSAKey.from_private_key(
io.StringIO(str(pkey)))
self.pkey = pkey
diff --git a/tempest/lib/common/utils/data_utils.py b/tempest/lib/common/utils/data_utils.py
index b6671b5..1e94f86 100644
--- a/tempest/lib/common/utils/data_utils.py
+++ b/tempest/lib/common/utils/data_utils.py
@@ -19,7 +19,6 @@
import uuid
from oslo_utils import uuidutils
-import six.moves
def rand_uuid():
@@ -171,7 +170,7 @@
"""
if size > 1 << 20:
raise RuntimeError('Size should be less than 1MiB')
- return b''.join([six.int2byte(random.randint(0, 255))
+ return b''.join([bytes((random.randint(0, 255),))
for i in range(size)])
diff --git a/tempest/lib/decorators.py b/tempest/lib/decorators.py
index 25ff473..a4633ca 100644
--- a/tempest/lib/decorators.py
+++ b/tempest/lib/decorators.py
@@ -16,7 +16,6 @@
import uuid
from oslo_log import log as logging
-import six
import testtools
from tempest.lib import exceptions as lib_exc
@@ -110,7 +109,7 @@
def idempotent_id(id):
"""Stub for metadata decorator"""
- if not isinstance(id, six.string_types):
+ if not isinstance(id, str):
raise TypeError('Test idempotent_id must be string not %s'
'' % type(id).__name__)
uuid.UUID(id)
@@ -140,7 +139,7 @@
# Check to see if the attr should be conditional applied.
if 'condition' in kwargs and not kwargs.get('condition'):
return f
- if 'type' in kwargs and isinstance(kwargs['type'], six.string_types):
+ if 'type' in kwargs and isinstance(kwargs['type'], str):
f = testtools.testcase.attr(kwargs['type'])(f)
elif 'type' in kwargs and isinstance(kwargs['type'], list):
for attr in kwargs['type']:
diff --git a/tempest/lib/services/identity/v3/oauth_token_client.py b/tempest/lib/services/identity/v3/oauth_token_client.py
index 236b224..564d6d6 100644
--- a/tempest/lib/services/identity/v3/oauth_token_client.py
+++ b/tempest/lib/services/identity/v3/oauth_token_client.py
@@ -20,8 +20,6 @@
import time
from urllib import parse as urlparse
-import six
-
from oslo_serialization import jsonutils as json
from tempest.lib.common import rest_client
@@ -35,7 +33,7 @@
safe = b'~'
s = s.encode('utf-8') if isinstance(s, str) else s
s = urlparse.quote(s, safe)
- if isinstance(s, six.binary_type):
+ if isinstance(s, bytes):
s = s.decode('utf-8')
return s
diff --git a/tempest/lib/services/volume/v1/volumes_client.py b/tempest/lib/services/volume/v1/volumes_client.py
index 9fca800..5d8d73b 100644
--- a/tempest/lib/services/volume/v1/volumes_client.py
+++ b/tempest/lib/services/volume/v1/volumes_client.py
@@ -16,7 +16,6 @@
from urllib import parse as urllib
from oslo_serialization import jsonutils as json
-import six
from tempest.lib.common import rest_client
from tempest.lib import exceptions as lib_exc
@@ -31,7 +30,7 @@
If params is a string it will be left as it is, but if it's not it will
be urlencoded.
"""
- if isinstance(params, six.string_types):
+ if isinstance(params, str):
return params
return urllib.urlencode(params)
diff --git a/tempest/lib/services/volume/v3/volumes_client.py b/tempest/lib/services/volume/v3/volumes_client.py
index 147a79b..9c6fe68 100644
--- a/tempest/lib/services/volume/v3/volumes_client.py
+++ b/tempest/lib/services/volume/v3/volumes_client.py
@@ -16,7 +16,6 @@
from urllib import parse as urllib
from oslo_serialization import jsonutils as json
-import six
from tempest.lib.api_schema.response.volume import volumes as schema
from tempest.lib.common import rest_client
@@ -33,7 +32,7 @@
If params is a string it will be left as it is, but if it's not it will
be urlencoded.
"""
- if isinstance(params, six.string_types):
+ if isinstance(params, str):
return params
return urllib.urlencode(params)
diff --git a/tempest/test.py b/tempest/test.py
index 655b9a4..a8f2f2b 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -384,7 +384,7 @@
# This may raise an exception in case credentials are not available
# In that case we want to let the exception through and the test
# fail accordingly
- if isinstance(credentials_type, six.string_types):
+ if isinstance(credentials_type, str):
manager = cls.get_client_manager(
credential_type=credentials_type)
setattr(cls, 'os_%s' % credentials_type, manager)
@@ -859,7 +859,7 @@
"""
# Get a manager for the given credentials_type, but at least
# always fall back on getting the manager for primary credentials
- if isinstance(credentials_type, six.string_types):
+ if isinstance(credentials_type, str):
manager = cls.get_client_manager(credential_type=credentials_type)
elif isinstance(credentials_type, list):
scope = 'project'
diff --git a/tempest/tests/lib/test_ssh.py b/tempest/tests/lib/test_ssh.py
index 035bdb0..886d99c 100644
--- a/tempest/tests/lib/test_ssh.py
+++ b/tempest/tests/lib/test_ssh.py
@@ -16,7 +16,6 @@
import socket
from unittest import mock
-import six
import testtools
from tempest.lib.common import ssh
@@ -240,7 +239,7 @@
return chan_mock, poll_mock, select_mock, client_mock
- _utf8_string = six.unichr(1071)
+ _utf8_string = chr(1071)
_utf8_bytes = _utf8_string.encode("utf-8")
@mock.patch('select.POLLIN', SELECT_POLLIN, create=True)