diff options
author | likui <likui@yovole.com> | 2020-09-03 16:05:38 +0800 |
---|---|---|
committer | likui <likui@yovole.com> | 2020-09-03 18:30:24 +0800 |
commit | 5bf159de3673ec81e7beaebe4b2fd474bf34616b (patch) | |
tree | 0dd8f53a4613e34491a75809184e4e08c676d1ef | |
parent | efc9bae2b9d6db4d9278293589d624f8b6244f80 (diff) | |
download | trove-5bf159de3673ec81e7beaebe4b2fd474bf34616b.tar.gz |
Remove six.PY3
The Python 2.7 Support has been dropped since Ussuri.
So remove hacking rules for compatibility between python 2 and 3.
Change-Id: Id3fd78b5d3e21579975ea0d0fc65e4f66ea4582e
-rw-r--r-- | integration/tests/integration/int_tests.py | 5 | ||||
-rw-r--r-- | integration/tests/integration/tests/colorizer.py | 6 | ||||
-rw-r--r-- | run_tests.py | 6 | ||||
-rw-r--r-- | trove/dns/designate/driver.py | 4 | ||||
-rw-r--r-- | trove/tests/fakes/swift.py | 5 | ||||
-rw-r--r-- | trove/tests/unittests/api/common/test_limits.py | 3 | ||||
-rw-r--r-- | trove/tests/unittests/domain-name-service/test_designate_driver.py | 7 |
7 files changed, 8 insertions, 28 deletions
diff --git a/integration/tests/integration/int_tests.py b/integration/tests/integration/int_tests.py index eee198b1..130ae514 100644 --- a/integration/tests/integration/int_tests.py +++ b/integration/tests/integration/int_tests.py @@ -70,10 +70,7 @@ def add_support_for_localization(): if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) - if six.PY3: - gettext.install('nova') - else: - gettext.install('nova', unicode=True) + gettext.install('nova') MAIN_RUNNER = None diff --git a/integration/tests/integration/tests/colorizer.py b/integration/tests/integration/tests/colorizer.py index 9f8dda27..3f32f24c 100644 --- a/integration/tests/integration/tests/colorizer.py +++ b/integration/tests/integration/tests/colorizer.py @@ -59,14 +59,10 @@ import heapq import logging import os import unittest -import six import sys import time -if six.PY3: - gettext.install('nova') -else: - gettext.install('nova', unicode=True) +gettext.install('nova') from nose import config from nose import core diff --git a/run_tests.py b/run_tests.py index b7219ddb..caa8a1f3 100644 --- a/run_tests.py +++ b/run_tests.py @@ -25,7 +25,6 @@ import traceback import eventlet from oslo_log import log as logging import proboscis -import six from six.moves import urllib import wsgi_intercept from wsgi_intercept.httplib2_intercept import install as wsgi_install @@ -57,10 +56,7 @@ def add_support_for_localization(): if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) - if six.PY3: - gettext.install('nova') - else: - gettext.install('nova', unicode=True) + gettext.install('nova') def initialize_trove(config_file): diff --git a/trove/dns/designate/driver.py b/trove/dns/designate/driver.py index d25859a3..7747d1f0 100644 --- a/trove/dns/designate/driver.py +++ b/trove/dns/designate/driver.py @@ -25,7 +25,6 @@ from keystoneauth1 import loading from keystoneauth1 import session from oslo_log import log as logging from oslo_utils import encodeutils -import six from trove.common import cfg from trove.common import exception @@ -110,8 +109,7 @@ class DesignateInstanceEntryFactory(driver.DnsInstanceEntryFactory): name = encodeutils.to_utf8(instance_id) name = hashlib.md5(name).digest() name = base64.b32encode(name)[:11].lower() - if six.PY3: - name = name.decode('ascii') + name = name.decode('ascii') hostname = ("%s.%s" % (name, zone.name)) # Removing the leading dot if present if hostname.endswith('.'): diff --git a/trove/tests/fakes/swift.py b/trove/tests/fakes/swift.py index 379aa8ff..7b8da07a 100644 --- a/trove/tests/fakes/swift.py +++ b/trove/tests/fakes/swift.py @@ -108,10 +108,7 @@ class FakeSwiftConnection(object): object_checksum = md5(self.container_objects[object_name]) # The manifest file etag for a HEAD or GET is the checksum of # the concatenated checksums. - if six.PY3: - checksum.update(object_checksum.hexdigest().encode()) - else: - checksum.update(object_checksum.hexdigest()) + checksum.update(object_checksum.hexdigest().encode()) # this is included to test bad swift segment etags if name.startswith("bad_manifest_etag_"): return {'etag': '"this_is_an_intentional_bad_manifest_etag"'} diff --git a/trove/tests/unittests/api/common/test_limits.py b/trove/tests/unittests/api/common/test_limits.py index 2cf3be08..7d8ee340 100644 --- a/trove/tests/unittests/api/common/test_limits.py +++ b/trove/tests/unittests/api/common/test_limits.py @@ -600,8 +600,7 @@ class FakeHttplibConnection(object): resp = str(req.get_response(self.app)) resp = "HTTP/1.0 %s" % resp - if six.PY3: - resp = resp.encode("utf-8") + resp = resp.encode("utf-8") sock = FakeHttplibSocket(resp) self.http_response = http_client.HTTPResponse(sock) self.http_response.begin() diff --git a/trove/tests/unittests/domain-name-service/test_designate_driver.py b/trove/tests/unittests/domain-name-service/test_designate_driver.py index 7a464e0b..4b07de9c 100644 --- a/trove/tests/unittests/domain-name-service/test_designate_driver.py +++ b/trove/tests/unittests/domain-name-service/test_designate_driver.py @@ -16,7 +16,6 @@ import hashlib from unittest.mock import MagicMock from unittest.mock import patch -import six from trove.common import exception from trove.dns.designate import driver @@ -89,8 +88,7 @@ class DesignateInstanceEntryFactoryTest(trove_testtools.TestCase): driver.DNS_TTL = 3600 hashed_id = hashlib.md5(instance_id.encode()).digest() hashed_id = base64.b32encode(hashed_id) - if six.PY3: - hashed_id = hashed_id.decode('ascii') + hashed_id = hashed_id.decode('ascii') hashed_id_concat = hashed_id[:11].lower() exp_hostname = ("%s.%s" % (hashed_id_concat, driver.DNS_DOMAIN_NAME)) factory = driver.DesignateInstanceEntryFactory() @@ -109,8 +107,7 @@ class DesignateInstanceEntryFactoryTest(trove_testtools.TestCase): driver.DNS_TTL = 3600 hashed_id = hashlib.md5(instance_id.encode()).digest() hashed_id = base64.b32encode(hashed_id) - if six.PY3: - hashed_id = hashed_id.decode('ascii') + hashed_id = hashed_id.decode('ascii') hashed_id_concat = hashed_id[:11].lower() exp_hostname = ("%s.%s" % (hashed_id_concat, driver.DNS_DOMAIN_NAME))[:-1] |