From 3159ce84f2745bcaeae61b313929046f0c6c6152 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 1 Feb 2024 16:08:16 +0900 Subject: [PATCH] Remove six from test codes This removes six from some of the tests code. The other test codes will be updated in per-driver changes. Change-Id: Ib168d5831ce30793b22a33aec85b81103a4150a7 --- cinder/tests/stubs/oslo_i18n/_message.pyi | 3 +-- cinder/tests/unit/volume/drivers/test_macrosan_drivers.py | 3 +-- cinder/tests/unit/volume/drivers/test_qnap.py | 5 ++--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cinder/tests/stubs/oslo_i18n/_message.pyi b/cinder/tests/stubs/oslo_i18n/_message.pyi index f5f380c69ba..74780be8f39 100644 --- a/cinder/tests/stubs/oslo_i18n/_message.pyi +++ b/cinder/tests/stubs/oslo_i18n/_message.pyi @@ -2,13 +2,12 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -import six from typing import Any, Optional CONTEXT_SEPARATOR: str LOG: Any -class Message(six.text_type): +class Message(str): def __new__(cls, msgid: Any, msgtext: Optional[Any] = ..., params: Optional[Any] = ..., domain: str = ..., has_contextual_form: bool = ..., has_plural_form: bool = ..., *args: Any): ... def translation(self, desired_locale: Optional[Any] = ...): ... def __mod__(self, other: Any): ... diff --git a/cinder/tests/unit/volume/drivers/test_macrosan_drivers.py b/cinder/tests/unit/volume/drivers/test_macrosan_drivers.py index bfccf150b91..4fd25c1aed2 100644 --- a/cinder/tests/unit/volume/drivers/test_macrosan_drivers.py +++ b/cinder/tests/unit/volume/drivers/test_macrosan_drivers.py @@ -13,12 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. """Tests for macrosan drivers.""" +from collections import UserDict import os import socket from unittest import mock -from six.moves import UserDict - from cinder import exception from cinder.tests.unit import test from cinder.volume import configuration as conf diff --git a/cinder/tests/unit/volume/drivers/test_qnap.py b/cinder/tests/unit/volume/drivers/test_qnap.py index b7ce86fc20a..6739efc645c 100644 --- a/cinder/tests/unit/volume/drivers/test_qnap.py +++ b/cinder/tests/unit/volume/drivers/test_qnap.py @@ -15,6 +15,7 @@ import collections from unittest import mock +import urllib from ddt import data from ddt import ddt @@ -23,8 +24,6 @@ import eventlet from lxml import etree as ET from oslo_utils import units import requests -import six -from six.moves import urllib from cinder import exception from cinder.tests.unit import test @@ -613,7 +612,7 @@ class QnapDriverBaseTestCase(test.TestCase): @staticmethod def sanitize(params): sanitized = {_key: str(_value) - for _key, _value in six.iteritems(params) + for _key, _value in params.items() if _value is not None} sanitized = utils.create_ordereddict(sanitized) return urllib.parse.urlencode(sanitized)