Remove six
Python 2 is no longer supported, thus usage of six can be removed.
Change-Id: I1a44b65768cb862e10d013801dd47cb0510b2d07
diff --git a/heat_tempest_plugin/common/remote_client.py b/heat_tempest_plugin/common/remote_client.py
index f23622b..aa652be 100644
--- a/heat_tempest_plugin/common/remote_client.py
+++ b/heat_tempest_plugin/common/remote_client.py
@@ -15,9 +15,9 @@
import socket
import time
+import io
from oslo_log import log as logging
import paramiko
-import six
from heat_tempest_plugin.common import exceptions
@@ -31,9 +31,9 @@
self.host = host
self.username = username
self.password = password
- if isinstance(pkey, six.string_types):
+ if isinstance(pkey, str):
pkey = paramiko.RSAKey.from_private_key(
- six.moves.cStringIO(str(pkey)))
+ io.cStringIO(str(pkey)))
self.pkey = pkey
self.look_for_keys = look_for_keys
self.key_filename = key_filename
@@ -151,7 +151,7 @@
network = self.conf.network_for_ssh
ip_version = self.conf.ip_version_for_ssh
ssh_channel_timeout = self.conf.ssh_channel_timeout
- if isinstance(server, six.string_types):
+ if isinstance(server, str):
ip_address = server
else:
addresses = server['addresses'][network]
diff --git a/heat_tempest_plugin/common/test.py b/heat_tempest_plugin/common/test.py
index 83ccdc2..3858859 100644
--- a/heat_tempest_plugin/common/test.py
+++ b/heat_tempest_plugin/common/test.py
@@ -21,10 +21,9 @@
from neutronclient.common import exceptions as network_exceptions
from oslo_log import log as logging
from oslo_utils import timeutils
-import six
-from six.moves import urllib
import testscenarios
import testtools
+import urllib
from heat_tempest_plugin.common import exceptions
from heat_tempest_plugin.common import remote_client
@@ -67,7 +66,7 @@
def rand_name(name=''):
- randbits = six.text_type(random.randint(1, 0x7fffffff))
+ randbits = str(random.randint(1, 0x7fffffff))
if name:
return name + '-' + randbits
else:
@@ -201,7 +200,7 @@
self.setup_clients(self.conf, True)
def get_remote_client(self, server_or_ip, username, private_key=None):
- if isinstance(server_or_ip, six.string_types):
+ if isinstance(server_or_ip, str):
ip = server_or_ip
else:
network_name_for_ssh = self.conf.network_for_ssh
diff --git a/heat_tempest_plugin/tests/api/test_heat_api.py b/heat_tempest_plugin/tests/api/test_heat_api.py
index d256437..214dc35 100644
--- a/heat_tempest_plugin/tests/api/test_heat_api.py
+++ b/heat_tempest_plugin/tests/api/test_heat_api.py
@@ -20,7 +20,6 @@
from gabbi import driver
import keystoneauth1
from oslo_log import log as logging
-import six
from tempest import config
from heat_tempest_plugin.common import test
@@ -101,7 +100,7 @@
test_loader_name=__name__)
except TypeError as ex:
err_msg = "got an unexpected keyword argument 'cert_validate'"
- if err_msg in six.text_type(ex):
+ if err_msg in str(ex):
api_tests = driver.build_tests(test_dir, loader,
url=endpoint, host="",
fixture_module=fixtures,
diff --git a/heat_tempest_plugin/tests/functional/test_preview.py b/heat_tempest_plugin/tests/functional/test_preview.py
index f1a6d72..d984272 100644
--- a/heat_tempest_plugin/tests/functional/test_preview.py
+++ b/heat_tempest_plugin/tests/functional/test_preview.py
@@ -11,7 +11,6 @@
# under the License.
from heatclient import exc
-import six
from tempest.lib import decorators
from heat_tempest_plugin.tests.functional import functional_base
@@ -133,7 +132,7 @@
self.assertIn('Property error: : resources.two.properties.value: '
': The Parameter (missing) was not provided.',
- six.text_type(excp))
+ str(excp))
@decorators.idempotent_id('0449113c-ff90-4f2b-8825-27ea35c1983f')
def test_nested_pass(self):
diff --git a/heat_tempest_plugin/tests/functional/test_remote_stack.py b/heat_tempest_plugin/tests/functional/test_remote_stack.py
index 6c5268c..f9409d1 100644
--- a/heat_tempest_plugin/tests/functional/test_remote_stack.py
+++ b/heat_tempest_plugin/tests/functional/test_remote_stack.py
@@ -12,7 +12,6 @@
from heatclient import exc
-import six
from tempest.lib import decorators
from heat_tempest_plugin.common import test
@@ -146,7 +145,7 @@
'at region "DARKHOLE" due to '
'"(?:public|internal|admin)(?:URL)? endpoint for '
'orchestration service in DARKHOLE region not found"')
- self.assertRegex(six.text_type(ex), error_msg)
+ self.assertRegex(str(ex), error_msg)
@decorators.idempotent_id('b2190dfc-d223-4595-b168-6c42b0f3a3e5')
def test_stack_resource_validation_fail(self):
@@ -159,7 +158,7 @@
'endpoint at region "%s" due to '
'"ERROR: The template section is '
'invalid: resource"') % self.conf.region
- self.assertEqual(error_msg, six.text_type(ex))
+ self.assertEqual(error_msg, str(ex))
@decorators.idempotent_id('141f0478-121b-4e61-bde7-d5551bfd1fc2')
def test_stack_update(self):
diff --git a/heat_tempest_plugin/tests/functional/test_template_validate.py b/heat_tempest_plugin/tests/functional/test_template_validate.py
index e41f952..46ad4a2 100644
--- a/heat_tempest_plugin/tests/functional/test_template_validate.py
+++ b/heat_tempest_plugin/tests/functional/test_template_validate.py
@@ -11,8 +11,6 @@
# under the License.
-import six
-
from heatclient import exc
from tempest.lib import decorators
@@ -169,7 +167,7 @@
ex = self.assertRaises(exc.HTTPBadRequest,
self.client.stacks.validate,
template=fail_template)
- self.assertIn('The template version is invalid', six.text_type(ex))
+ self.assertIn('The template version is invalid', str(ex))
@decorators.idempotent_id('6a6472d2-71fa-4ebe-a2b6-20878838555b')
def test_template_validate_parameter_groups(self):
diff --git a/heat_tempest_plugin/tests/scenario/test_remote_deeply_nested.py b/heat_tempest_plugin/tests/scenario/test_remote_deeply_nested.py
index ef05285..5ed428b 100644
--- a/heat_tempest_plugin/tests/scenario/test_remote_deeply_nested.py
+++ b/heat_tempest_plugin/tests/scenario/test_remote_deeply_nested.py
@@ -10,7 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
import uuid
from heat_tempest_plugin.tests.scenario import scenario_base
@@ -33,7 +32,7 @@
stack = self.client.stacks.get(stack_id)
router_id = self._stack_output(stack, 'router')
- self.assertIsInstance(router_id, six.string_types)
+ self.assertIsInstance(router_id, str)
uuid.UUID(router_id)
self._stack_delete(stack_id)
diff --git a/heat_tempest_plugin/tests/scenario/test_server_software_config.py b/heat_tempest_plugin/tests/scenario/test_server_software_config.py
index 7da2853..1f2499b 100644
--- a/heat_tempest_plugin/tests/scenario/test_server_software_config.py
+++ b/heat_tempest_plugin/tests/scenario/test_server_software_config.py
@@ -11,7 +11,6 @@
# under the License.
from heatclient.common import template_utils
-import six
from tempest.lib import decorators
from heat_tempest_plugin.tests.scenario import scenario_base
@@ -89,7 +88,7 @@
# config isn't re-triggered
complete_deployments = dict((d['name'], d) for d in
complete_server_metadata['deployments'])
- for k, v in six.iteritems(deployments):
+ for k, v in deployments.items():
self.assertEqual(v, complete_deployments[k])
stack = self.client.stacks.get(sid)
diff --git a/heat_tempest_plugin/tests/scenario/test_volumes.py b/heat_tempest_plugin/tests/scenario/test_volumes.py
index 3a179a9..97369d6 100644
--- a/heat_tempest_plugin/tests/scenario/test_volumes.py
+++ b/heat_tempest_plugin/tests/scenario/test_volumes.py
@@ -14,7 +14,6 @@
from cinderclient import exceptions as cinder_exceptions
import copy
from oslo_log import log as logging
-import six
from tempest.lib import decorators
from heat_tempest_plugin.common import exceptions
@@ -44,7 +43,7 @@
def _outputs_verify(self, stack, expected_status='available'):
self.assertEqual(expected_status,
self._stack_output(stack, 'status'))
- self.assertEqual(six.text_type(self.volume_size),
+ self.assertEqual(str(self.volume_size),
self._stack_output(stack, 'size'))
self.assertEqual(self.volume_description,
self._stack_output(stack, 'display_description'))