Remove six of dir cinder/tests/functional&hacking/*
Replace the following items with Python 3 style code. - six.moves - six.string_types Change-Id: Ibabf36a4b1aea9df39291883aef77b0c29b18df6 Implements: blueprint six-removal
This commit is contained in:
parent
6ad1ab0c72
commit
919cbbd4df
|
@ -12,11 +12,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from http import client as http_client
|
||||
import urllib
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import netutils
|
||||
import requests
|
||||
from six.moves import http_client
|
||||
from six.moves import urllib
|
||||
|
||||
from cinder.i18n import _
|
||||
from cinder.tests.unit import fake_constants as fake
|
||||
|
|
|
@ -15,7 +15,6 @@ import pprint
|
|||
import re
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
from cinder.tests.functional import functional_helpers
|
||||
from cinder.tests.unit import test
|
||||
|
@ -89,7 +88,7 @@ class ApiSampleTestBase(functional_helpers._FunctionalTestBase):
|
|||
non_strings = \
|
||||
{k: v for k, v in value.items() if
|
||||
(not k == 'volume_host') and
|
||||
(not isinstance(v, six.string_types))}
|
||||
(not isinstance(v, str))}
|
||||
if len(non_strings) > 0:
|
||||
raise TypeError("subs can't contain non-string values:"
|
||||
"\n%(non_strings)s" %
|
||||
|
@ -269,7 +268,7 @@ class ApiSampleTestBase(functional_helpers._FunctionalTestBase):
|
|||
matched_value = self._compare_list(
|
||||
expected, result, result_str, matched_value)
|
||||
# template string
|
||||
elif isinstance(expected, six.string_types) and '%' in expected:
|
||||
elif isinstance(expected, str) and '%' in expected:
|
||||
if expected[-1] == '%':
|
||||
if result != expected:
|
||||
raise NoMatch(
|
||||
|
@ -282,11 +281,11 @@ class ApiSampleTestBase(functional_helpers._FunctionalTestBase):
|
|||
matched_value = self._compare_template(
|
||||
expected, result, result_str, matched_value)
|
||||
# string
|
||||
elif isinstance(expected, six.string_types):
|
||||
elif isinstance(expected, str):
|
||||
|
||||
# Ignore whitespace in this comparison
|
||||
expected = expected.strip()
|
||||
if isinstance(result, six.string_types):
|
||||
if isinstance(result, str):
|
||||
result = result.strip()
|
||||
|
||||
if expected != result:
|
||||
|
@ -297,7 +296,7 @@ class ApiSampleTestBase(functional_helpers._FunctionalTestBase):
|
|||
'result_str': result_str,
|
||||
'result': result})
|
||||
# int
|
||||
elif isinstance(expected, (six.integer_types, float)):
|
||||
elif isinstance(expected, (int, float)):
|
||||
if expected != result:
|
||||
raise NoMatch(
|
||||
'Values do not match:\n'
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from http import client as http_client
|
||||
|
||||
import iso8601
|
||||
from oslo_config import cfg
|
||||
from oslo_serialization import jsonutils
|
||||
from six.moves import http_client
|
||||
import webob
|
||||
|
||||
from cinder.api import extensions
|
||||
|
|
|
@ -16,7 +16,6 @@ import ast
|
|||
import re
|
||||
|
||||
from hacking import core
|
||||
import six
|
||||
|
||||
"""
|
||||
Guidelines for writing new hacking checks
|
||||
|
@ -182,7 +181,7 @@ class CheckLoggingFormatArgs(BaseASTChecker):
|
|||
if obj_name is None:
|
||||
return None
|
||||
return obj_name + '.' + method_name
|
||||
elif isinstance(node, six.string_types):
|
||||
elif isinstance(node, str):
|
||||
return node
|
||||
else: # could be Subscript, Call or many more
|
||||
return None
|
||||
|
@ -251,7 +250,7 @@ class CheckOptRegistrationArgs(BaseASTChecker):
|
|||
if obj_name is None:
|
||||
return None
|
||||
return obj_name + '.' + method_name
|
||||
elif isinstance(node, six.string_types):
|
||||
elif isinstance(node, str):
|
||||
return node
|
||||
else: # could be Subscript, Call or many more
|
||||
return None
|
||||
|
|
Loading…
Reference in New Issue