Merge "Remove six"

This commit is contained in:
Zuul 2023-12-20 14:21:30 +00:00 committed by Gerrit Code Review
commit a6b818bce9
9 changed files with 15 additions and 24 deletions

View File

@ -15,9 +15,9 @@ import select
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 @@ class Client(object):
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 @@ class RemoteClient(object):
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]

View File

@ -21,10 +21,9 @@ from keystoneauth1 import exceptions as kc_exceptions
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 isotime(at):
def rand_name(name=''):
randbits = six.text_type(random.randint(1, 0x7fffffff))
randbits = str(random.randint(1, 0x7fffffff))
if name:
return name + '-' + randbits
else:
@ -204,7 +203,7 @@ class HeatIntegrationTest(testtools.testcase.WithAttributes,
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

View File

@ -20,7 +20,6 @@ import unittest
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 @@ def load_tests(loader, tests, pattern):
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,

View File

@ -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 @@ parameters:
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):

View File

@ -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 @@ outputs:
'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 @@ outputs:
'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):

View File

@ -11,8 +11,6 @@
# under the License.
import six
from heatclient import exc
from tempest.lib import decorators
@ -169,7 +167,7 @@ resources:
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):

View File

@ -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 @@ class RemoteDeeplyNestedStackTest(scenario_base.ScenarioTestsBase):
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)

View File

@ -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 @@ class SoftwareConfigIntegrationTest(scenario_base.ScenarioTestsBase):
# 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)

View File

@ -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 @@ class VolumeBackupRestoreIntegrationTest(scenario_base.ScenarioTestsBase):
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'))