From 4c3bf8f80068ccfd28dd68dfae20c6bca948326b Mon Sep 17 00:00:00 2001 From: songwenping Date: Tue, 5 Jan 2021 03:27:09 +0000 Subject: [PATCH] Remove usage of six Remove six-library Replace the following items with Python 3 style code. - six.add_metaclass Change-Id: I7da3e8898e00bc07f6e462cbc9765ce7c199faa2 --- tempest/lib/auth.py | 4 +--- tempest/lib/common/cred_client.py | 4 +--- tempest/lib/common/cred_provider.py | 4 +--- tempest/test_discover/plugins.py | 4 +--- tempest/tests/lib/test_decorators.py | 4 +--- 5 files changed, 5 insertions(+), 15 deletions(-) diff --git a/tempest/lib/auth.py b/tempest/lib/auth.py index ab9860e449..8bdf98e5a6 100644 --- a/tempest/lib/auth.py +++ b/tempest/lib/auth.py @@ -21,7 +21,6 @@ import re from urllib import parse as urlparse from oslo_log import log as logging -import six from tempest.lib import exceptions from tempest.lib.services.identity.v2 import token_client as json_v2id @@ -65,8 +64,7 @@ def apply_url_filters(url, filters): return url -@six.add_metaclass(abc.ABCMeta) -class AuthProvider(object): +class AuthProvider(object, metaclass=abc.ABCMeta): """Provide authentication""" SCOPES = set(['project']) diff --git a/tempest/lib/common/cred_client.py b/tempest/lib/common/cred_client.py index f6e9b49ebd..f13d6d0334 100644 --- a/tempest/lib/common/cred_client.py +++ b/tempest/lib/common/cred_client.py @@ -13,7 +13,6 @@ import abc from oslo_log import log as logging -import six from tempest.lib import auth from tempest.lib import exceptions as lib_exc @@ -22,8 +21,7 @@ from tempest.lib.services.identity.v2 import identity_client as v2_identity LOG = logging.getLogger(__name__) -@six.add_metaclass(abc.ABCMeta) -class CredsClient(object): +class CredsClient(object, metaclass=abc.ABCMeta): """This class is a wrapper around the identity clients to provide a single interface for managing credentials in both v2 and v3 diff --git a/tempest/lib/common/cred_provider.py b/tempest/lib/common/cred_provider.py index d0fccbcc3e..35bca1dd9f 100644 --- a/tempest/lib/common/cred_provider.py +++ b/tempest/lib/common/cred_provider.py @@ -14,14 +14,12 @@ import abc -import six from tempest.lib import auth from tempest.lib import exceptions -@six.add_metaclass(abc.ABCMeta) -class CredentialProvider(object): +class CredentialProvider(object, metaclass=abc.ABCMeta): def __init__(self, identity_version, name=None, network_resources=None, credentials_domain=None, admin_role=None, identity_uri=None): diff --git a/tempest/test_discover/plugins.py b/tempest/test_discover/plugins.py index b20b60e410..1d69d9d297 100644 --- a/tempest/test_discover/plugins.py +++ b/tempest/test_discover/plugins.py @@ -15,7 +15,6 @@ import abc from oslo_log import log as logging -import six import stevedore from tempest.lib.common.utils import misc @@ -24,8 +23,7 @@ from tempest.lib.services import clients LOG = logging.getLogger(__name__) -@six.add_metaclass(abc.ABCMeta) -class TempestPlugin(object): +class TempestPlugin(object, metaclass=abc.ABCMeta): """Provide basic hooks for an external plugin To provide tempest the necessary information to run the plugin. diff --git a/tempest/tests/lib/test_decorators.py b/tempest/tests/lib/test_decorators.py index e3c17e8b9d..fc93f76a84 100644 --- a/tempest/tests/lib/test_decorators.py +++ b/tempest/tests/lib/test_decorators.py @@ -16,7 +16,6 @@ import abc from unittest import mock -import six import testtools from tempest.lib import base as test @@ -69,8 +68,7 @@ class TestAttrDecorator(base.TestCase): condition=True) -@six.add_metaclass(abc.ABCMeta) -class BaseSkipDecoratorTests(object): +class BaseSkipDecoratorTests(object, metaclass=abc.ABCMeta): @abc.abstractmethod def _test_skip_helper(self, raise_exception=True, expected_to_skip=True,