Stop using six library
Since we've dropped support for Python 2.7, it's time to look at the bright future that Python 3.x will bring and stop forcing compatibility with older versions. This patch removes the six library from requirements, not looking back. Change-Id: Ib546f16965475c32b2f8caabd560e2c7d382ac5a
This commit is contained in:
@@ -13,8 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from http import client as http_client
|
||||
|
||||
import mock
|
||||
from six.moves import http_client
|
||||
from webob import exc
|
||||
|
||||
from ironic.api.controllers import base as cbase
|
||||
|
||||
@@ -14,15 +14,14 @@ Tests for the API /allocations/ methods.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
from http import client as http_client
|
||||
from urllib import parse as urlparse
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from six.moves import http_client
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from wsme import types as wtypes
|
||||
|
||||
from ironic.api.controllers import base as api_base
|
||||
@@ -175,7 +174,7 @@ class TestListAllocations(test_api_base.BaseApiTest):
|
||||
self.assertEqual(len(allocations), len(data['allocations']))
|
||||
|
||||
uuids = [n['uuid'] for n in data['allocations']]
|
||||
six.assertCountEqual(self, allocations, uuids)
|
||||
self.assertCountEqual(allocations, uuids)
|
||||
|
||||
def test_links(self):
|
||||
uuid = uuidutils.generate_uuid()
|
||||
|
||||
@@ -16,14 +16,13 @@ Tests for the API /chassis/ methods.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
from http import client as http_client
|
||||
from urllib import parse as urlparse
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from six.moves import http_client
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from wsme import types as wtypes
|
||||
|
||||
from ironic.api.controllers import base as api_base
|
||||
@@ -181,7 +180,7 @@ class TestListChassis(test_api_base.BaseApiTest):
|
||||
data = self.get_json('/chassis')
|
||||
self.assertEqual(len(ch_list), len(data['chassis']))
|
||||
uuids = [n['uuid'] for n in data['chassis']]
|
||||
six.assertCountEqual(self, ch_list, uuids)
|
||||
self.assertCountEqual(ch_list, uuids)
|
||||
|
||||
def _test_links(self, public_url=None):
|
||||
cfg.CONF.set_override('public_endpoint', public_url, 'api')
|
||||
|
||||
@@ -14,12 +14,12 @@ Tests for the API /conductors/ methods.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
from http import client as http_client
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
from six.moves import http_client
|
||||
|
||||
from ironic.api.controllers import base as api_base
|
||||
from ironic.api.controllers import v1 as api_v1
|
||||
|
||||
@@ -14,14 +14,13 @@ Tests for the API /deploy_templates/ methods.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
from http import client as http_client
|
||||
from urllib import parse as urlparse
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from six.moves import http_client
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ironic.api.controllers import base as api_base
|
||||
from ironic.api.controllers import v1 as api_v1
|
||||
@@ -207,7 +206,7 @@ class TestListDeployTemplates(BaseDeployTemplatesAPITest):
|
||||
self.assertEqual(len(templates), len(data['deploy_templates']))
|
||||
|
||||
uuids = [n['uuid'] for n in data['deploy_templates']]
|
||||
six.assertCountEqual(self, templates, uuids)
|
||||
self.assertCountEqual(templates, uuids)
|
||||
|
||||
def test_links(self):
|
||||
uuid = uuidutils.generate_uuid()
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from http import client as http_client
|
||||
import json
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from six.moves import http_client
|
||||
from testtools import matchers
|
||||
|
||||
from ironic.api.controllers import base as api_base
|
||||
|
||||
@@ -13,8 +13,9 @@
|
||||
Tests for the API /events methods.
|
||||
"""
|
||||
|
||||
from http import client as http_client
|
||||
|
||||
import mock
|
||||
from six.moves import http_client
|
||||
|
||||
from ironic.api.controllers import base as api_base
|
||||
from ironic.api.controllers.v1 import types
|
||||
|
||||
@@ -14,16 +14,15 @@ Tests for the API /nodes/ methods.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
from http import client as http_client
|
||||
import json
|
||||
from urllib import parse as urlparse
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from six.moves import http_client
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from testtools import matchers
|
||||
from wsme import types as wtypes
|
||||
|
||||
@@ -3476,8 +3475,7 @@ class TestPost(test_api_base.BaseApiTest):
|
||||
is_async=True):
|
||||
expected_status = http_client.ACCEPTED if is_async else http_client.OK
|
||||
expected_return_value = json.dumps(return_value)
|
||||
if six.PY3:
|
||||
expected_return_value = expected_return_value.encode('utf-8')
|
||||
expected_return_value = expected_return_value.encode('utf-8')
|
||||
|
||||
node = obj_utils.create_test_node(self.context)
|
||||
info = {'foo': 'bar'}
|
||||
@@ -3495,8 +3493,7 @@ class TestPost(test_api_base.BaseApiTest):
|
||||
is_async=True):
|
||||
expected_status = http_client.ACCEPTED if is_async else http_client.OK
|
||||
expected_return_value = json.dumps(return_value)
|
||||
if six.PY3:
|
||||
expected_return_value = expected_return_value.encode('utf-8')
|
||||
expected_return_value = expected_return_value.encode('utf-8')
|
||||
|
||||
node = obj_utils.create_test_node(self.context, name='node-109')
|
||||
info = {'foo': 'bar'}
|
||||
|
||||
@@ -14,15 +14,14 @@ Tests for the API /ports/ methods.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
from http import client as http_client
|
||||
import types
|
||||
from urllib import parse as urlparse
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from six.moves import http_client
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from testtools import matchers
|
||||
from wsme import types as wtypes
|
||||
|
||||
@@ -580,7 +579,7 @@ class TestListPorts(test_api_base.BaseApiTest):
|
||||
self.assertEqual(len(ports), len(data['ports']))
|
||||
|
||||
uuids = [n['uuid'] for n in data['ports']]
|
||||
six.assertCountEqual(self, ports, uuids)
|
||||
self.assertCountEqual(ports, uuids)
|
||||
|
||||
def _test_links(self, public_url=None):
|
||||
cfg.CONF.set_override('public_endpoint', public_url, 'api')
|
||||
|
||||
@@ -14,14 +14,13 @@ Tests for the API /portgroups/ methods.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
from http import client as http_client
|
||||
from urllib import parse as urlparse
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from six.moves import http_client
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from testtools.matchers import HasLength
|
||||
from wsme import types as wtypes
|
||||
|
||||
@@ -277,7 +276,7 @@ class TestListPortgroups(test_api_base.BaseApiTest):
|
||||
self.assertEqual(len(portgroups), len(data['portgroups']))
|
||||
|
||||
uuids = [n['uuid'] for n in data['portgroups']]
|
||||
six.assertCountEqual(self, portgroups, uuids)
|
||||
self.assertCountEqual(portgroups, uuids)
|
||||
|
||||
def test_links(self):
|
||||
uuid = uuidutils.generate_uuid()
|
||||
|
||||
@@ -15,11 +15,12 @@
|
||||
Tests for the API /lookup/ methods.
|
||||
"""
|
||||
|
||||
from http import client as http_client
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import uuidutils
|
||||
from six.moves import http_client
|
||||
|
||||
from ironic.api.controllers import base as api_base
|
||||
from ironic.api.controllers import v1 as api_v1
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from http import client as http_client
|
||||
import platform
|
||||
|
||||
import mock
|
||||
import six
|
||||
from six.moves import http_client
|
||||
import webtest
|
||||
import wsme
|
||||
from wsme import types as wtypes
|
||||
@@ -264,8 +264,7 @@ class TestJsonType(base.TestCase):
|
||||
def test_apimultitype_tostring(self):
|
||||
vts = str(types.jsontype)
|
||||
self.assertIn(str(wtypes.text), vts)
|
||||
for int_type in six.integer_types:
|
||||
self.assertIn(str(int_type), vts)
|
||||
self.assertIn(str(int), vts)
|
||||
self.assertIn(str(float), vts)
|
||||
self.assertIn(str(types.BooleanType), vts)
|
||||
self.assertIn(str(list), vts)
|
||||
|
||||
@@ -14,11 +14,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from http import client as http_client
|
||||
|
||||
import mock
|
||||
import os_traits
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import uuidutils
|
||||
from six.moves import http_client
|
||||
from webob import static
|
||||
import wsme
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
Tests for the API /volume/ methods.
|
||||
"""
|
||||
|
||||
from six.moves import http_client
|
||||
from http import client as http_client
|
||||
|
||||
from ironic.api.controllers import base as api_base
|
||||
from ironic.api.controllers import v1 as api_v1
|
||||
|
||||
@@ -16,14 +16,13 @@ Tests for the API /volume connectors/ methods.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
from http import client as http_client
|
||||
from urllib import parse as urlparse
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from six.moves import http_client
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from wsme import types as wtypes
|
||||
|
||||
from ironic.api.controllers import base as api_base
|
||||
@@ -222,7 +221,7 @@ class TestListVolumeConnectors(test_api_base.BaseApiTest):
|
||||
self.assertEqual(len(connectors), len(data['connectors']))
|
||||
|
||||
uuids = [n['uuid'] for n in data['connectors']]
|
||||
six.assertCountEqual(self, connectors, uuids)
|
||||
self.assertCountEqual(connectors, uuids)
|
||||
|
||||
def test_links(self):
|
||||
uuid = uuidutils.generate_uuid()
|
||||
|
||||
@@ -16,14 +16,13 @@ Tests for the API /volume targets/ methods.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
from http import client as http_client
|
||||
from urllib import parse as urlparse
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from six.moves import http_client
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from wsme import types as wtypes
|
||||
|
||||
from ironic.api.controllers import base as api_base
|
||||
@@ -212,7 +211,7 @@ class TestListVolumeTargets(test_api_base.BaseApiTest):
|
||||
self.assertEqual(len(targets), len(data['targets']))
|
||||
|
||||
uuids = [n['uuid'] for n in data['targets']]
|
||||
six.assertCountEqual(self, targets, uuids)
|
||||
self.assertCountEqual(targets, uuids)
|
||||
|
||||
def test_links(self):
|
||||
uuid = uuidutils.generate_uuid()
|
||||
|
||||
Reference in New Issue
Block a user