Remove six

Python 2 is no longer supported, thus usage of six can be removed.

Change-Id: I60259f7b326ac862409b4d8a0591859a0f070e8b
This commit is contained in:
Takashi Kajinami 2022-05-10 00:58:56 +09:00
parent d3360cf3b6
commit 6bddaab162
7 changed files with 14 additions and 16 deletions

View File

@ -13,7 +13,6 @@
# under the License.
from oslo_log import log
import six
from tempest import config
from tempest.lib.common.utils import test_utils
from tempest.lib import exceptions as lib_exc
@ -31,8 +30,8 @@ def _determine_and_check_timeout_interval(timeout, default_timeout,
timeout = default_timeout
if interval is None:
interval = default_interval
if (not isinstance(timeout, six.integer_types)
or not isinstance(interval, six.integer_types)
if (not isinstance(timeout, int)
or not isinstance(interval, int)
or timeout < 0 or interval < 0):
raise AssertionError(
'timeout and interval should be >= 0 or None, current values are: '

View File

@ -11,10 +11,11 @@
# under the License.
import functools
from http import client as http_client
from urllib import parse as urllib_parse
from oslo_serialization import jsonutils as json
import six
from six.moves import http_client
from six.moves.urllib import parse as urllib
from tempest.lib.common import api_version_utils
from tempest.lib.common import rest_client
@ -36,7 +37,7 @@ def reset_baremetal_api_microversion():
def handle_errors(f):
"""A decorator that allows to ignore certain types of errors."""
@six.wraps(f)
@functools.wraps(f)
def wrapper(*args, **kwargs):
param_name = 'ignore_errors'
ignored_errors = kwargs.get(param_name, tuple())
@ -149,7 +150,7 @@ class BaremetalClient(rest_client.RestClient):
"""
uri = self._get_uri(resource, permanent=permanent)
if kwargs:
uri += "?%s" % urllib.urlencode(kwargs)
uri += "?%s" % urllib_parse.urlencode(kwargs)
resp, body = self.get(uri, headers=headers,
extra_headers=extra_headers)

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from six.moves import http_client
from http import client as http_client
from ironic_tempest_plugin.services.baremetal import base

View File

@ -11,7 +11,6 @@
# under the License.
from oslo_utils import uuidutils
import six
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
@ -136,7 +135,7 @@ class TestNodes(base.BaseBaremetalTest):
body = self.client.get_node_boot_device(self.node['uuid'])
self.assertIn('boot_device', body)
self.assertIn('persistent', body)
self.assertIsInstance(body['boot_device'], six.string_types)
self.assertIsInstance(body['boot_device'], str)
self.assertIsInstance(body['persistent'], bool)
@decorators.idempotent_id('3622bc6f-3589-4bc2-89f3-50419c66b133')

View File

@ -10,7 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
import functools
from tempest import config
from tempest.lib.common import api_version_utils
from tempest.lib.common.utils import data_utils
@ -41,7 +42,7 @@ def creates(resource):
"""Decorator that adds resources to the appropriate cleanup list."""
def decorator(f):
@six.wraps(f)
@functools.wraps(f)
def wrapper(cls, *args, **kwargs):
resp, body = f(cls, *args, **kwargs)

View File

@ -14,7 +14,6 @@ import os
import time
from oslo_serialization import jsonutils as json
import six
import tempest
from tempest import config
from tempest.lib.common.api_version_utils import LATEST_MICROVERSION
@ -173,7 +172,7 @@ class InspectorScenarioTest(BaremetalScenarioTest):
"""Waits for introspection of baremetal nodes to finish.
"""
if isinstance(node_ids, six.text_type):
if isinstance(node_ids, str):
node_ids = [node_ids]
start = int(time.time())
not_introspected = {node_id for node_id in node_ids}

View File

@ -8,5 +8,4 @@ oslo.log>=3.36.0 # Apache-2.0
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
six>=1.10.0 # MIT
tempest>=17.1.0 # Apache-2.0