From: Kefu Chai Date: Sun, 19 Jul 2020 08:50:44 +0000 (+0800) Subject: test/rgw/rgw_multi: drop python2 support X-Git-Tag: v16.1.0~1654^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=55e212268f9258acdfd2540ae60efec027013bb2;p=ceph.git test/rgw/rgw_multi: drop python2 support Signed-off-by: Kefu Chai --- diff --git a/src/test/rgw/rgw_multi/multisite.py b/src/test/rgw/rgw_multi/multisite.py index d591f340e64c..25ddda5322cf 100644 --- a/src/test/rgw/rgw_multi/multisite.py +++ b/src/test/rgw/rgw_multi/multisite.py @@ -1,5 +1,5 @@ from abc import ABCMeta, abstractmethod -from six import StringIO +from io import StringIO import json diff --git a/src/test/rgw/rgw_multi/tests.py b/src/test/rgw/rgw_multi/tests.py index 018aa4bd4ec4..37694977cd25 100644 --- a/src/test/rgw/rgw_multi/tests.py +++ b/src/test/rgw/rgw_multi/tests.py @@ -6,13 +6,8 @@ import time import logging import errno -try: - from itertools import izip_longest as zip_longest # type: ignore -except ImportError: - from itertools import zip_longest from itertools import combinations -from six import StringIO -from six.moves import range +from io import StringIO import boto import boto.s3.connection diff --git a/src/test/rgw/rgw_multi/tests_es.py b/src/test/rgw/rgw_multi/tests_es.py index 1854c4cfedb0..08c11718bd04 100644 --- a/src/test/rgw/rgw_multi/tests_es.py +++ b/src/test/rgw/rgw_multi/tests_es.py @@ -7,8 +7,9 @@ import boto.s3.connection import datetime import dateutil +from itertools import zip_longest # type: ignore + from nose.tools import eq_ as eq -from six.moves import range from .multisite import * from .tests import * diff --git a/src/test/rgw/rgw_multi/tests_ps.py b/src/test/rgw/rgw_multi/tests_ps.py index 8b5fc1d41c2d..dcc947607212 100644 --- a/src/test/rgw/rgw_multi/tests_ps.py +++ b/src/test/rgw/rgw_multi/tests_ps.py @@ -1,13 +1,13 @@ import logging import json import tempfile -from six.moves import BaseHTTPServer import random import threading import subprocess import socket import time import os +from http import server as http_server from random import randint from .tests import get_realm, \ ZonegroupConns, \ @@ -54,7 +54,7 @@ def set_contents_from_string(key, content): # HTTP endpoint functions # multithreaded streaming server, based on: https://stackoverflow.com/questions/46210672/ -class HTTPPostHandler(BaseHTTPServer.BaseHTTPRequestHandler): +class HTTPPostHandler(http_server.BaseHTTPRequestHandler): """HTTP POST hanler class storing the received events in its http server""" def do_POST(self): """implementation of POST handler""" @@ -72,10 +72,10 @@ class HTTPPostHandler(BaseHTTPServer.BaseHTTPRequestHandler): self.end_headers() -class HTTPServerWithEvents(BaseHTTPServer.HTTPServer): +class HTTPServerWithEvents(http_server.HTTPServer): """HTTP server used by the handler to store events""" def __init__(self, addr, handler, worker_id): - BaseHTTPServer.HTTPServer.__init__(self, addr, handler, False) + http_server.HTTPServer.__init__(self, addr, handler, False) self.worker_id = worker_id self.events = [] diff --git a/src/test/rgw/rgw_multi/zone_cloud.py b/src/test/rgw/rgw_multi/zone_cloud.py index eb945a44bc21..322a19e6d180 100644 --- a/src/test/rgw/rgw_multi/zone_cloud.py +++ b/src/test/rgw/rgw_multi/zone_cloud.py @@ -11,12 +11,8 @@ import datetime import re from nose.tools import eq_ as eq -try: - from itertools import izip_longest as zip_longest # type: ignore -except ImportError: - from itertools import zip_longest - -from six.moves.urllib.parse import urlparse +from itertools import zip_longest # type: ignore +from urllib.parse import urlparse from .multisite import * from .tools import * diff --git a/src/test/rgw/rgw_multi/zone_es.py b/src/test/rgw/rgw_multi/zone_es.py index 7ba31a430789..204b9e47f2e3 100644 --- a/src/test/rgw/rgw_multi/zone_es.py +++ b/src/test/rgw/rgw_multi/zone_es.py @@ -8,10 +8,7 @@ import boto.s3.connection import dateutil.parser from nose.tools import eq_ as eq -try: - from itertools import izip_longest as zip_longest # type: ignore -except ImportError: - from itertools import zip_longest +from itertools import zip_longest # type: ignore from .multisite import * from .tools import * diff --git a/src/test/rgw/rgw_multi/zone_ps.py b/src/test/rgw/rgw_multi/zone_ps.py index 84413f5565d8..241bbe8a26e2 100644 --- a/src/test/rgw/rgw_multi/zone_ps.py +++ b/src/test/rgw/rgw_multi/zone_ps.py @@ -5,8 +5,8 @@ import hmac import hashlib import base64 import xmltodict -from six.moves import http_client -from six.moves.urllib import parse as urlparse +from http import client as http_client +from urllib import parse as urlparse from time import gmtime, strftime from .multisite import Zone import boto3 diff --git a/src/test/rgw/rgw_multi/zone_rados.py b/src/test/rgw/rgw_multi/zone_rados.py index 3b298e8b42f7..984b0c2ffca0 100644 --- a/src/test/rgw/rgw_multi/zone_rados.py +++ b/src/test/rgw/rgw_multi/zone_rados.py @@ -1,10 +1,7 @@ import logging from boto.s3.deletemarker import DeleteMarker -try: - from itertools import izip_longest as zip_longest # type: ignore -except ImportError: - from itertools import zip_longest +from itertools import zip_longest # type: ignore from nose.tools import eq_ as eq