Remove all usage of six library
Replace six with Python 3 style code.
Change-Id: I724eba28d1a88317655f9cb7da94716772cd01ab
diff --git a/manila_tempest_tests/tests/api/admin/test_export_locations.py b/manila_tempest_tests/tests/api/admin/test_export_locations.py
index 7d09f69..db382f2 100644
--- a/manila_tempest_tests/tests/api/admin/test_export_locations.py
+++ b/manila_tempest_tests/tests/api/admin/test_export_locations.py
@@ -16,7 +16,6 @@
import ddt
from oslo_utils import timeutils
from oslo_utils import uuidutils
-import six
from tempest import config
from tempest.lib import decorators
from testtools import testcase as tc
@@ -91,7 +90,7 @@
# Check the format of ever-present summary keys
self.assertTrue(uuidutils.is_uuid_like(export_location['id']))
self.assertIsInstance(export_location['path'],
- six.string_types)
+ str)
if utils.is_microversion_ge(version, '2.14'):
self.assertIn(export_location['preferred'], (True, False))
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers.py b/manila_tempest_tests/tests/api/admin/test_share_servers.py
index fd553ff..b406a92 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers.py
@@ -16,7 +16,6 @@
import re
import ddt
-import six
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
@@ -120,7 +119,7 @@
else:
msg = ("Appropriate server was not found. Its share_network_data"
": '%s'. List of servers: '%s'.") % (self.sn_name_and_id,
- six.text_type(servers))
+ str(servers))
raise lib_exc.NotFound(message=msg)
search_opts = {"host": host}
servers = self.shares_v2_client.list_share_servers(
@@ -226,8 +225,8 @@
# If details are present they and their values should be only strings
for k, v in details.items():
- self.assertIsInstance(k, six.string_types)
- self.assertIsInstance(v, six.string_types)
+ self.assertIsInstance(k, str)
+ self.assertIsInstance(v, str)
@decorators.idempotent_id('2fdf8d29-3ab8-4424-b684-6253f45b9666')
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
diff --git a/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py b/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
index fca92c7..1c6a9b7 100644
--- a/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
+++ b/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
@@ -15,7 +15,6 @@
import ddt
from oslo_utils import uuidutils
-import six
from tempest import config
from tempest.lib import decorators
from testtools import testcase as tc
@@ -94,7 +93,7 @@
# Check the format of ever-present summary keys
self.assertTrue(uuidutils.is_uuid_like(export_location['id']))
self.assertIsInstance(export_location['path'],
- six.string_types)
+ str)
if role == 'admin':
self.assertIn(export_location['is_admin_only'], (True, False))
diff --git a/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py b/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py
index f2fb48f..36ddf7e 100644
--- a/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
+
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
@@ -51,7 +51,7 @@
cls.extra_specs = {
'storage_protocol': CONF.share.capability_storage_protocol,
'driver_handles_share_servers': CONF.share.multitenancy_enabled,
- 'snapshot_support': six.text_type(
+ 'snapshot_support': str(
CONF.share.capability_snapshot_support),
}
diff --git a/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py b/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py
index 197b883..e675387 100644
--- a/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py
@@ -10,7 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_utils import uuidutils
-import six
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
@@ -47,7 +46,7 @@
def test_show_nonexistent_message(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.get_message,
- six.text_type(uuidutils.generate_uuid()))
+ str(uuidutils.generate_uuid()))
@decorators.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@decorators.idempotent_id('2f5be1aa-974b-4f6a-ae3a-084578e64f82')
@@ -61,7 +60,7 @@
def test_delete_nonexistent_message(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.delete_message,
- six.text_type(uuidutils.generate_uuid()))
+ str(uuidutils.generate_uuid()))
@decorators.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@utils.skip_if_microversion_not_supported(QUERY_BY_TIMESTAMP_MICROVERSION)
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index dd25062..648c9f8 100755
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -18,7 +18,6 @@
import traceback
from oslo_log import log
-import six
from tempest import config
from tempest.lib.common import cred_client
from tempest.lib.common.utils import data_utils
@@ -636,8 +635,8 @@
extra_specs = {}
for k, v in share_type['extra_specs'].items():
extra_specs[k] = (
- True if six.text_type(v).lower() == 'true'
- else False if six.text_type(v).lower() == 'false' else v
+ True if str(v).lower() == 'true'
+ else False if str(v).lower() == 'false' else v
)
return [
pool for pool in pools if all(y in pool['capabilities'].items()
@@ -1077,7 +1076,7 @@
@staticmethod
def add_extra_specs_to_dict(extra_specs=None):
"""Add any required extra-specs to share type dictionary"""
- dhss = six.text_type(CONF.share.multitenancy_enabled)
+ dhss = str(CONF.share.multitenancy_enabled)
extra_specs_dict = {"driver_handles_share_servers": dhss}
if extra_specs:
extra_specs_dict.update(extra_specs)
diff --git a/manila_tempest_tests/tests/api/test_security_services.py b/manila_tempest_tests/tests/api/test_security_services.py
index 5bfbc2e..24d8bad 100644
--- a/manila_tempest_tests/tests/api/test_security_services.py
+++ b/manila_tempest_tests/tests/api/test_security_services.py
@@ -15,7 +15,6 @@
import ddt
from oslo_log import log
-import six
from tempest import config
from tempest.lib import decorators
import testtools
@@ -252,7 +251,7 @@
LOG.warning("Caught exception. It is expected in case backend "
"fails having security-service with improper data "
"that leads to share-server creation error. "
- "%s", six.text_type(e))
+ "%s", str(e))
update_data = {
"name": "name",
diff --git a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
index 9aaf20b..d0bb321 100644
--- a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
+++ b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
@@ -14,7 +14,6 @@
# under the License.
from oslo_log import log
-import six
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
@@ -136,7 +135,7 @@
LOG.warning("Caught exception. It is expected in case backend "
"fails having security-service with improper data "
"that leads to share-server creation error. "
- "%s", six.text_type(e))
+ "%s", str(e))
self.assertRaises(lib_exc.Forbidden,
self.cl.remove_sec_service_from_share_network,
diff --git a/manila_tempest_tests/tests/api/test_security_services_negative.py b/manila_tempest_tests/tests/api/test_security_services_negative.py
index 3895fa9..08e3c7b 100644
--- a/manila_tempest_tests/tests/api/test_security_services_negative.py
+++ b/manila_tempest_tests/tests/api/test_security_services_negative.py
@@ -14,7 +14,6 @@
# under the License.
from oslo_log import log
-import six
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
@@ -120,7 +119,7 @@
LOG.warning("Caught exception. It is expected in case backend "
"fails having security-service with improper data "
"that leads to share-server creation error. "
- "%s", six.text_type(e))
+ "%s", str(e))
self.assertRaises(lib_exc.Forbidden,
self.shares_client.update_security_service,
diff --git a/manila_tempest_tests/tests/api/test_shares_actions.py b/manila_tempest_tests/tests/api/test_shares_actions.py
index 4cdc70d..3232d50 100644
--- a/manila_tempest_tests/tests/api/test_shares_actions.py
+++ b/manila_tempest_tests/tests/api/test_shares_actions.py
@@ -14,7 +14,6 @@
# under the License.
import ddt
-import six
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
@@ -93,7 +92,7 @@
# get share
share = self.shares_v2_client.get_share(
- self.shares[0]['id'], version=six.text_type(version))['share']
+ self.shares[0]['id'], version=str(version))['share']
# verify keys
expected_keys = [
@@ -125,13 +124,13 @@
# verify values
msg = "Expected name: '%s', actual name: '%s'" % (self.share_name,
share["name"])
- self.assertEqual(self.share_name, six.text_type(share["name"]), msg)
+ self.assertEqual(self.share_name, str(share["name"]), msg)
msg = ("Expected description: '%s', "
"actual description: '%s'" % (self.share_desc,
share["description"]))
self.assertEqual(
- self.share_desc, six.text_type(share["description"]), msg)
+ self.share_desc, str(share["description"]), msg)
msg = "Expected size: '%s', actual size: '%s'" % (
CONF.share.share_size, share["size"])
@@ -211,7 +210,7 @@
# list shares
shares = self.shares_v2_client.list_shares_with_detail(
- version=six.text_type(version))['shares']
+ version=str(version))['shares']
# verify keys
keys = [
diff --git a/manila_tempest_tests/tests/api/test_snapshot_rules.py b/manila_tempest_tests/tests/api/test_snapshot_rules.py
index 541e861..74d5221 100644
--- a/manila_tempest_tests/tests/api/test_snapshot_rules.py
+++ b/manila_tempest_tests/tests/api/test_snapshot_rules.py
@@ -14,7 +14,6 @@
# under the License.
import ddt
-import six
from tempest import config
from tempest.lib import decorators
from testtools import testcase as tc
@@ -54,7 +53,7 @@
access_to)['snapshot_access']
for key in ('deleted', 'deleted_at', 'instance_mappings'):
- self.assertNotIn(key, list(six.iterkeys(rule)))
+ self.assertNotIn(key, list(rule.keys()))
waiters.wait_for_resource_status(
self.shares_v2_client, self.snapshot['id'], 'active',