From 1203b762fa269ac647db9e507d72e88ef29c56f8 Mon Sep 17 00:00:00 2001 From: "Q.hongtao" Date: Mon, 21 Sep 2020 09:10:44 +0800 Subject: [PATCH] Remove six Replace the following items with Python 3 style code. - six.moves.BaseHttpServer - six.moves.zip - six.PY2 - six.viewitems Change-Id: If68cc2778bfccc56248ab8fba3de764044a707e9 --- requirements.txt | 1 - vitrage_tempest_plugin/tests/api/event/test_events.py | 3 +-- vitrage_tempest_plugin/tests/base.py | 6 ------ vitrage_tempest_plugin/tests/common/general_utils.py | 3 +-- vitrage_tempest_plugin/tests/e2e/test_e2e_webhook.py | 2 +- 5 files changed, 3 insertions(+), 12 deletions(-) diff --git a/requirements.txt b/requirements.txt index 5b1df32..62848dc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,6 @@ python-novaclient>=10.1.0 # Apache-2.0 python-mistralclient>=3.3.0 # Apache-2.0 python-glanceclient>=2.8.0 # Apache-2.0 python-vitrageclient>=2.0.0 # Apache-2.0 -six>=1.10.0 # MIT oslo.config>=5.2.0 # Apache-2.0 oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0 diff --git a/vitrage_tempest_plugin/tests/api/event/test_events.py b/vitrage_tempest_plugin/tests/api/event/test_events.py index ba8ad0b..c24e326 100644 --- a/vitrage_tempest_plugin/tests/api/event/test_events.py +++ b/vitrage_tempest_plugin/tests/api/event/test_events.py @@ -12,7 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -import six from datetime import datetime from oslo_log import log as logging @@ -57,7 +56,7 @@ class TestEvents(BaseTestEvents): 'Expected host down alarm') alarm = api_alarms[0] - event_time_tz = six.u(event_time.strftime('%Y-%m-%dT%H:%M:%SZ')) + event_time_tz = str(event_time.strftime('%Y-%m-%dT%H:%M:%SZ')) self._check_alarm(alarm, event_time_tz, event_type, details) event_time = datetime.now() diff --git a/vitrage_tempest_plugin/tests/base.py b/vitrage_tempest_plugin/tests/base.py index a3771fd..e9b2182 100644 --- a/vitrage_tempest_plugin/tests/base.py +++ b/vitrage_tempest_plugin/tests/base.py @@ -18,8 +18,6 @@ from itertools import islice import networkx as nx from networkx.readwrite import json_graph -import six -from six.moves import zip from oslo_log import log as logging from oslo_utils import timeutils @@ -56,10 +54,6 @@ LOG = logging.getLogger(__name__) IsEmpty = lambda: HasLength(0) IsNotEmpty = lambda: Not(IsEmpty()) -if six.PY2: - class ResourceWarning(Warning): - pass - class BaseVitrageTempest(test.BaseTestCase): """Base test class for All Vitrage tests.""" diff --git a/vitrage_tempest_plugin/tests/common/general_utils.py b/vitrage_tempest_plugin/tests/common/general_utils.py index 42c2cb3..d7c8eb8 100644 --- a/vitrage_tempest_plugin/tests/common/general_utils.py +++ b/vitrage_tempest_plugin/tests/common/general_utils.py @@ -12,7 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. from os import path -import six def first_match(list_of_dicts, **kwargs): @@ -33,7 +32,7 @@ def is_subset(subset, full): full_dict = full if type(full) is not dict: full_dict = vars(full) - return six.viewitems(subset) <= six.viewitems(full_dict) + return subset.items() <= full_dict.items() def _remove_none_values(**kwargs): diff --git a/vitrage_tempest_plugin/tests/e2e/test_e2e_webhook.py b/vitrage_tempest_plugin/tests/e2e/test_e2e_webhook.py index 459aae7..8c10800 100644 --- a/vitrage_tempest_plugin/tests/e2e/test_e2e_webhook.py +++ b/vitrage_tempest_plugin/tests/e2e/test_e2e_webhook.py @@ -13,9 +13,9 @@ # under the License. import ast +import http.server as BaseHTTPServer from oslo_log import log as logging import requests -from six.moves import BaseHTTPServer import socket from testtools import matchers from threading import Thread