summaryrefslogtreecommitdiff
path: root/nova
diff options
context:
space:
mode:
authorTakashi Natsume <takanattie@gmail.com>2020-05-14 15:01:28 +0000
committerTakashi Natsume <takanattie@gmail.com>2020-12-13 11:26:35 +0000
commit1cf2431f4bf815fc828a7878bd80f5f5bd8e8319 (patch)
treed493731db6a3bca4d6d7becb8f5cee594ce767be /nova
parent383e2a8bdcc9210cbe9719d3470fe15b787d46b0 (diff)
downloadnova-1cf2431f4bf815fc828a7878bd80f5f5bd8e8319.tar.gz
Remove six.text_type (2/2)
Replace six.text_type with str. This patch completes six removal. Change-Id: I779bd1446dc1f070fa5100ccccda7881fa508d79 Implements: blueprint six-removal Signed-off-by: Takashi Natsume <takanattie@gmail.com>
Diffstat (limited to 'nova')
-rw-r--r--nova/tests/functional/libvirt/test_numa_servers.py6
-rw-r--r--nova/tests/functional/test_boot_from_volume.py3
-rw-r--r--nova/tests/functional/test_conf_max_attach_disk_devices.py4
-rw-r--r--nova/tests/functional/test_cross_az_attach.py4
-rw-r--r--nova/tests/functional/test_server_group.py3
-rw-r--r--nova/tests/functional/test_servers.py26
-rw-r--r--nova/tests/functional/wsgi/test_servers.py9
-rw-r--r--nova/tests/functional/wsgi/test_services.py7
-rw-r--r--nova/tests/unit/api/openstack/compute/test_admin_password.py4
-rw-r--r--nova/tests/unit/api/openstack/compute/test_attach_interfaces.py3
-rw-r--r--nova/tests/unit/api/openstack/compute/test_baremetal_nodes.py3
-rw-r--r--nova/tests/unit/api/openstack/compute/test_create_backup.py3
-rw-r--r--nova/tests/unit/api/openstack/compute/test_evacuate.py3
-rw-r--r--nova/tests/unit/api/openstack/compute/test_flavor_manage.py7
-rw-r--r--nova/tests/unit/api/openstack/compute/test_hypervisors.py9
-rw-r--r--nova/tests/unit/api/openstack/compute/test_instance_actions.py15
-rw-r--r--nova/tests/unit/api/openstack/compute/test_lock_server.py7
-rw-r--r--nova/tests/unit/api/openstack/compute/test_migrate_server.py7
-rw-r--r--nova/tests/unit/api/openstack/compute/test_migrations.py17
-rw-r--r--nova/tests/unit/api/openstack/compute/test_server_external_events.py4
-rw-r--r--nova/tests/unit/api/openstack/compute/test_server_groups.py12
-rw-r--r--nova/tests/unit/api/openstack/compute/test_server_start_stop.py5
-rw-r--r--nova/tests/unit/api/openstack/compute/test_servers.py100
-rw-r--r--nova/tests/unit/api/openstack/compute/test_services.py13
-rw-r--r--nova/tests/unit/api/openstack/compute/test_shelve.py7
-rw-r--r--nova/tests/unit/api/openstack/compute/test_suspend_server.py3
-rw-r--r--nova/tests/unit/api/openstack/compute/test_volumes.py33
-rw-r--r--nova/tests/unit/api/openstack/test_common.py3
-rw-r--r--nova/tests/unit/compute/test_api.py11
-rw-r--r--nova/tests/unit/compute/test_compute.py3
-rw-r--r--nova/tests/unit/compute/test_compute_mgr.py24
-rw-r--r--nova/tests/unit/compute/test_compute_utils.py3
-rw-r--r--nova/tests/unit/compute/test_instance_list.py3
-rw-r--r--nova/tests/unit/compute/test_keypairs.py5
-rw-r--r--nova/tests/unit/compute/test_rpcapi.py13
-rw-r--r--nova/tests/unit/conductor/tasks/test_cross_cell_migrate.py10
-rw-r--r--nova/tests/unit/conductor/tasks/test_live_migrate.py3
-rw-r--r--nova/tests/unit/conductor/test_conductor.py3
-rw-r--r--nova/tests/unit/console/securityproxy/test_rfb.py8
-rw-r--r--nova/tests/unit/db/test_db_api.py3
-rw-r--r--nova/tests/unit/db/test_sqlalchemy_migration.py3
-rw-r--r--nova/tests/unit/matchers.py5
-rw-r--r--nova/tests/unit/network/test_neutron.py23
-rw-r--r--nova/tests/unit/network/test_os_vif_util.py3
-rw-r--r--nova/tests/unit/objects/test_host_mapping.py5
-rw-r--r--nova/tests/unit/objects/test_image_meta.py3
-rw-r--r--nova/tests/unit/objects/test_instance.py3
-rw-r--r--nova/tests/unit/objects/test_instance_action.py10
-rw-r--r--nova/tests/unit/objects/test_objects.py15
-rw-r--r--nova/tests/unit/objects/test_resource.py4
-rw-r--r--nova/tests/unit/objects/test_service.py3
-rw-r--r--nova/tests/unit/pci/test_devspec.py15
-rw-r--r--nova/tests/unit/scheduler/client/test_report.py13
-rw-r--r--nova/tests/unit/scheduler/filters/test_compute_capabilities_filters.py12
-rw-r--r--nova/tests/unit/scheduler/test_scheduler_utils.py3
-rw-r--r--nova/tests/unit/scheduler/test_utils.py3
-rw-r--r--nova/tests/unit/test_api_validation.py3
-rw-r--r--nova/tests/unit/test_availability_zones.py3
-rw-r--r--nova/tests/unit/test_block_device.py8
-rw-r--r--nova/tests/unit/test_exception.py14
-rw-r--r--nova/tests/unit/test_metadata.py3
-rw-r--r--nova/tests/unit/test_rpc.py3
-rw-r--r--nova/tests/unit/test_test.py23
-rw-r--r--nova/tests/unit/test_utils.py4
-rw-r--r--nova/tests/unit/virt/ironic/test_driver.py5
-rw-r--r--nova/tests/unit/virt/libvirt/test_driver.py27
-rw-r--r--nova/tests/unit/virt/libvirt/test_guest.py5
-rw-r--r--nova/tests/unit/virt/libvirt/test_migration.py6
-rw-r--r--nova/tests/unit/virt/libvirt/test_vif.py7
-rw-r--r--nova/tests/unit/virt/libvirt/volume/test_quobyte.py3
-rw-r--r--nova/tests/unit/virt/powervm/test_driver.py5
-rw-r--r--nova/tests/unit/virt/test_images.py3
-rw-r--r--nova/tests/unit/virt/test_virt.py3
-rw-r--r--nova/tests/unit/virt/vmwareapi/test_vmops.py5
-rw-r--r--nova/tests/unit/volume/test_cinder.py9
75 files changed, 274 insertions, 397 deletions
diff --git a/nova/tests/functional/libvirt/test_numa_servers.py b/nova/tests/functional/libvirt/test_numa_servers.py
index 28f8463aea..40142ee49c 100644
--- a/nova/tests/functional/libvirt/test_numa_servers.py
+++ b/nova/tests/functional/libvirt/test_numa_servers.py
@@ -14,7 +14,6 @@
# under the License.
import mock
-import six
import testtools
from oslo_config import cfg
@@ -1110,7 +1109,7 @@ class NUMAServersWithNetworksTest(NUMAServersTestBase):
# is a cast, but since we are using CastAsCall this will bubble to the
# API.
self.assertEqual(500, ex.response.status_code)
- self.assertIn('NoValidHost', six.text_type(ex))
+ self.assertIn('NoValidHost', str(ex))
def test_cold_migrate_with_physnet(self):
@@ -1260,5 +1259,4 @@ class NUMAServersRebuildTests(NUMAServersTestBase):
client.OpenStackApiException, self._rebuild_server,
server, self.image_ref_1)
self.assertEqual(400, ex.response.status_code)
- self.assertIn("An instance's NUMA topology cannot be changed",
- six.text_type(ex))
+ self.assertIn("An instance's NUMA topology cannot be changed", str(ex))
diff --git a/nova/tests/functional/test_boot_from_volume.py b/nova/tests/functional/test_boot_from_volume.py
index 6de676dbd8..8815e6c7c1 100644
--- a/nova/tests/functional/test_boot_from_volume.py
+++ b/nova/tests/functional/test_boot_from_volume.py
@@ -11,7 +11,6 @@
# under the License.
import mock
-import six
from nova import context
from nova import objects
@@ -160,7 +159,7 @@ class BootFromVolumeTest(integrated_helpers._IntegratedTestBase):
{'server': server})
self.assertEqual(400, ex.response.status_code)
self.assertIn('You specified more local devices than the limit allows',
- six.text_type(ex))
+ str(ex))
class BootFromVolumeLargeRequestTest(test.TestCase,
diff --git a/nova/tests/functional/test_conf_max_attach_disk_devices.py b/nova/tests/functional/test_conf_max_attach_disk_devices.py
index 517a65b055..4277686446 100644
--- a/nova/tests/functional/test_conf_max_attach_disk_devices.py
+++ b/nova/tests/functional/test_conf_max_attach_disk_devices.py
@@ -12,8 +12,6 @@
import time
-import six
-
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client
from nova.tests.functional import integrated_helpers
@@ -103,7 +101,7 @@ class ConfigurableMaxDiskDevicesTest(integrated_helpers._IntegratedTestBase):
self.assertEqual(403, ex.response.status_code)
expected = ('The maximum allowed number of disk devices (2) to attach '
'to a single instance has been exceeded.')
- self.assertIn(expected, six.text_type(ex))
+ self.assertIn(expected, str(ex))
# Verify only one volume is attached (this is a generator)
attached_vols = list(self.cinder.volume_ids_for_instance(server_id))
self.assertIn(vol_id, attached_vols)
diff --git a/nova/tests/functional/test_cross_az_attach.py b/nova/tests/functional/test_cross_az_attach.py
index 3cf6402015..3fdcaf6f26 100644
--- a/nova/tests/functional/test_cross_az_attach.py
+++ b/nova/tests/functional/test_cross_az_attach.py
@@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
-
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client as api_client
@@ -132,7 +130,7 @@ class CrossAZAttachTestCase(test.TestCase,
self.assertEqual(400, ex.response.status_code)
self.assertIn('Server and volumes are not in the same availability '
'zone. Server is in: london. Volumes are in: %s' %
- self.az, six.text_type(ex))
+ self.az, str(ex))
def test_cross_az_attach_false_no_volumes(self):
"""A simple test to make sure cross_az_attach=False API validation is
diff --git a/nova/tests/functional/test_server_group.py b/nova/tests/functional/test_server_group.py
index f7f293c817..8a29d31dba 100644
--- a/nova/tests/functional/test_server_group.py
+++ b/nova/tests/functional/test_server_group.py
@@ -15,7 +15,6 @@
import mock
from oslo_config import cfg
-import six
from nova.compute import instance_actions
from nova import context
@@ -1020,7 +1019,7 @@ class TestAntiAffinityLiveMigration(test.TestCase,
self.admin_api.post_server_action,
server['id'], body)
self.assertEqual(400, ex.response.status_code)
- self.assertIn('No valid host', six.text_type(ex))
+ self.assertIn('No valid host', str(ex))
# Now start up a 3rd compute service and retry the live migration which
# should work this time.
diff --git a/nova/tests/functional/test_servers.py b/nova/tests/functional/test_servers.py
index 8568a8876b..13421760a8 100644
--- a/nova/tests/functional/test_servers.py
+++ b/nova/tests/functional/test_servers.py
@@ -29,7 +29,6 @@ from oslo_serialization import jsonutils
from oslo_utils import fixture as osloutils_fixture
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import timeutils
-import six
from nova.compute import api as compute_api
from nova.compute import instance_actions
@@ -778,7 +777,7 @@ class ServersTest(integrated_helpers._IntegratedTestBase):
expected = ('The maximum allowed number of disk devices (26) to '
'attach to a single instance has been exceeded.')
self.assertEqual(403, ex.response.status_code)
- self.assertIn(expected, six.text_type(ex))
+ self.assertIn(expected, str(ex))
class ServersTestV21(ServersTest):
@@ -1206,7 +1205,7 @@ class ServerTestV269(integrated_helpers._IntegratedTestBase):
self.api.get_servers,
search_opts={'limit': 5})
self.assertEqual(500, exp.response.status_code)
- self.assertIn('NovaException', six.text_type(exp))
+ self.assertIn('NovaException', str(exp))
def test_get_servers_detail_marker_in_down_cells(self):
marker = self.down_cell_insts[2]
@@ -1215,7 +1214,7 @@ class ServerTestV269(integrated_helpers._IntegratedTestBase):
self.api.get_servers,
search_opts={'marker': marker})
self.assertEqual(500, exp.response.status_code)
- self.assertIn('oslo_db.exception.DBError', six.text_type(exp))
+ self.assertIn('oslo_db.exception.DBError', str(exp))
def test_get_servers_detail_marker_sorting(self):
marker = self.up_cell_insts[1]
@@ -1378,7 +1377,7 @@ class ServerRebuildTestCase(integrated_helpers._IntegratedTestBase):
ex = self.assertRaises(
client.OpenStackApiException, self.api.api_post,
'/servers/%s/action' % server['id'], rebuild_req_body)
- self.assertIn('NoValidHost', six.text_type(ex))
+ self.assertIn('NoValidHost', str(ex))
# A rebuild to the same host should never attempt a rebuild claim.
@mock.patch('nova.compute.resource_tracker.ResourceTracker.rebuild_claim',
@@ -1518,7 +1517,7 @@ class ServerRebuildTestCase(integrated_helpers._IntegratedTestBase):
# Assert that we failed because of the image change and not something
# else.
self.assertIn('Unable to rebuild with a different image for a '
- 'volume-backed server', six.text_type(resp))
+ 'volume-backed server', str(resp))
class ServersTestV280(integrated_helpers._IntegratedTestBase):
@@ -2279,7 +2278,7 @@ class ServerMovingTests(integrated_helpers.ProviderUsageBaseTestCase):
ex = self.assertRaises(client.OpenStackApiException,
self.api.post_server_action,
server['id'], post)
- self.assertIn("'force' was unexpected", six.text_type(ex))
+ self.assertIn("'force' was unexpected", str(ex))
# NOTE(gibi): there is a similar test in SchedulerOnlyChecksTargetTest but
# we want this test here as well because ServerMovingTest is a parent class
@@ -2706,7 +2705,7 @@ class ServerMovingTests(integrated_helpers.ProviderUsageBaseTestCase):
ex = self.assertRaises(client.OpenStackApiException,
self.api.post_server_action,
server['id'], post)
- self.assertIn("'force' was unexpected", six.text_type(ex))
+ self.assertIn("'force' was unexpected", str(ex))
def test_live_migrate(self):
source_hostname = self.compute1.host
@@ -3369,7 +3368,7 @@ class PollUnconfirmedResizesTest(integrated_helpers.ProviderUsageBaseTestCase):
self.api.post_server_action,
server['id'], {'confirmResize': None})
self.assertEqual(409, ex.response.status_code)
- self.assertIn('Service is unavailable at this time', six.text_type(ex))
+ self.assertIn('Service is unavailable at this time', str(ex))
# Bring the source compute back up and try to confirm the resize which
# should work since the migration status is still "finished".
self.restart_compute_service(self.computes['host1'])
@@ -4575,8 +4574,7 @@ class ServerTestV256MultiCellTestCase(ServerTestV256Common):
# the target host in cell1, it will result in a ComputeHostNotFound
# error.
self.assertEqual(400, ex.response.status_code)
- self.assertIn('Compute host host2 could not be found',
- six.text_type(ex))
+ self.assertIn('Compute host host2 could not be found', str(ex))
class ServerTestV256SingleCellMultiHostTestCase(ServerTestV256Common):
@@ -5911,7 +5909,7 @@ class UnsupportedPortResourceRequestBasedSchedulingTest(
self.assertEqual(400, ex.response.status_code)
self.assertIn('Attaching interfaces with QoS policy is '
'not supported for instance',
- six.text_type(ex))
+ str(ex))
@mock.patch('nova.tests.fixtures.NeutronFixture.create_port')
def test_interface_attach_with_network_create_port_has_resource_request(
@@ -5939,7 +5937,7 @@ class UnsupportedPortResourceRequestBasedSchedulingTest(
self.assertEqual(400, ex.response.status_code)
self.assertIn('Using networks with QoS policy is not supported for '
'instance',
- six.text_type(ex))
+ str(ex))
@mock.patch('nova.tests.fixtures.NeutronFixture.create_port')
def test_create_server_with_network_create_port_has_resource_request(
@@ -5974,7 +5972,7 @@ class UnsupportedPortResourceRequestBasedSchedulingTest(
"Creating servers with ports having resource requests, like a "
"port with a QoS minimum bandwidth policy, is not supported "
"until microversion 2.72.",
- six.text_type(ex))
+ str(ex))
def test_unshelve_not_offloaded_server_with_port_resource_request(
self):
diff --git a/nova/tests/functional/wsgi/test_servers.py b/nova/tests/functional/wsgi/test_servers.py
index 8dd7ef03dd..de0d982bb0 100644
--- a/nova/tests/functional/wsgi/test_servers.py
+++ b/nova/tests/functional/wsgi/test_servers.py
@@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
-
from nova.policies import base as base_policies
from nova.policies import servers as servers_policies
from nova import test
@@ -357,7 +355,7 @@ class EnforceVolumeBackedForZeroDiskFlavorTestCase(
ex = self.assertRaises(api_client.OpenStackApiException,
self.api.post_server, {'server': server_req})
self.assertIn('Only volume-backed servers are allowed for flavors '
- 'with zero disk.', six.text_type(ex))
+ 'with zero disk.', str(ex))
self.assertEqual(403, ex.response.status_code)
def test_create_volume_backed_server_with_zero_disk_allowed(self):
@@ -415,7 +413,7 @@ class ResizeCheckInstanceHostTestCase(
ex = self.assertRaises(api_client.OpenStackApiException,
self.api.post_server_action, server['id'], req)
self.assertEqual(409, ex.response.status_code)
- self.assertIn('Service is unavailable at this time', six.text_type(ex))
+ self.assertIn('Service is unavailable at this time', str(ex))
# Now bring the source compute service up but disable it. The operation
# should be allowed in this case since the service is up.
self.api.put_service(source_service['id'],
@@ -437,8 +435,7 @@ class ResizeCheckInstanceHostTestCase(
self.assertEqual(409, ex.response.status_code)
# This error comes from check_instance_state which is processed before
# check_instance_host.
- self.assertIn('while it is in vm_state shelved_offloaded',
- six.text_type(ex))
+ self.assertIn('while it is in vm_state shelved_offloaded', str(ex))
def test_cold_migrate_source_compute_validation(self):
self.test_resize_source_compute_validation(resize=False)
diff --git a/nova/tests/functional/wsgi/test_services.py b/nova/tests/functional/wsgi/test_services.py
index f73a79b389..e513247130 100644
--- a/nova/tests/functional/wsgi/test_services.py
+++ b/nova/tests/functional/wsgi/test_services.py
@@ -12,7 +12,6 @@
import os_resource_classes as orc
import os_traits
-import six
from nova import context as nova_context
from nova import exception
@@ -83,7 +82,7 @@ class TestServicesAPI(integrated_helpers.ProviderUsageBaseTestCase):
self.admin_api.api_delete,
'/os-services/%s' % service['id'])
self.assertIn('Unable to delete compute service that is hosting '
- 'instances.', six.text_type(ex))
+ 'instances.', str(ex))
self.assertEqual(409, ex.response.status_code)
# Now delete the instance and wait for it to be gone.
@@ -198,7 +197,7 @@ class TestServicesAPI(integrated_helpers.ProviderUsageBaseTestCase):
'/os-services/%s' % service['id'])
self.assertEqual(409, ex.response.status_code)
self.assertIn('Unable to delete compute service that has in-progress '
- 'migrations', six.text_type(ex))
+ 'migrations', str(ex))
self.assertIn('There are 1 in-progress migrations involving the host',
self.stdlog.logger.output)
# The provider is still around because we did not delete the service.
@@ -243,7 +242,7 @@ class TestServicesAPI(integrated_helpers.ProviderUsageBaseTestCase):
'/os-services/%s' % service['id'])
self.assertEqual(409, ex.response.status_code)
self.assertIn('Unable to delete compute service that has in-progress '
- 'migrations', six.text_type(ex))
+ 'migrations', str(ex))
self.assertIn('There are 1 in-progress migrations involving the host',
self.stdlog.logger.output)
# The provider is still around because we did not delete the service.
diff --git a/nova/tests/unit/api/openstack/compute/test_admin_password.py b/nova/tests/unit/api/openstack/compute/test_admin_password.py
index 48049c7361..90a4a2983b 100644
--- a/nova/tests/unit/api/openstack/compute/test_admin_password.py
+++ b/nova/tests/unit/api/openstack/compute/test_admin_password.py
@@ -14,7 +14,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
-import six
import webob
from nova.api.openstack.compute import admin_password as admin_password_v21
@@ -126,8 +125,7 @@ class AdminPasswordTestV21(test.NoDBTestCase):
ex = self.assertRaises(self.validation_error,
self._get_action(),
self.fake_req, fakes.FAKE_UUID, body=body)
- self.assertIn('adminPass. Value: None. None is not of type',
- six.text_type(ex))
+ self.assertIn('adminPass. Value: None. None is not of type', str(ex))
def test_change_password_adminpass_none(self):
body = {'changePassword': None}
diff --git a/nova/tests/unit/api/openstack/compute/test_attach_interfaces.py b/nova/tests/unit/api/openstack/compute/test_attach_interfaces.py
index da917d4118..26ebab0bea 100644
--- a/nova/tests/unit/api/openstack/compute/test_attach_interfaces.py
+++ b/nova/tests/unit/api/openstack/compute/test_attach_interfaces.py
@@ -14,7 +14,6 @@
# under the License.
import mock
-import six
from webob import exc
from nova.api.openstack import common
@@ -325,7 +324,7 @@ class InterfaceAttachTestsV21(test.NoDBTestCase):
ex = self.assertRaises(
exc.HTTPForbidden, self.attachments.create,
self.req, FAKE_UUID1, body=body)
- self.assertIn('Maximum number of ports exceeded', six.text_type(ex))
+ self.assertIn('Maximum number of ports exceeded', str(ex))
def test_detach_interface_with_invalid_state(self):
def fake_detach_interface_invalid_state(*args, **kwargs):
diff --git a/nova/tests/unit/api/openstack/compute/test_baremetal_nodes.py b/nova/tests/unit/api/openstack/compute/test_baremetal_nodes.py
index 8a3b66162d..55a8b03216 100644
--- a/nova/tests/unit/api/openstack/compute/test_baremetal_nodes.py
+++ b/nova/tests/unit/api/openstack/compute/test_baremetal_nodes.py
@@ -16,7 +16,6 @@
from ironicclient import exc as ironic_exc
import mock
-import six
from webob import exc
from nova.api.openstack.compute import baremetal_nodes \
@@ -181,7 +180,7 @@ class BareMetalNodesTestV21(test.NoDBTestCase):
def test_show_ironic_node_not_found(self, mock_get):
error = self.assertRaises(exc.HTTPNotFound, self.controller.show,
self.request, 'fake-uuid')
- self.assertIn('fake-uuid', six.text_type(error))
+ self.assertIn('fake-uuid', str(error))
def test_show_ironic_not_implemented(self):
with mock.patch.object(self.mod, 'ironic_client', None):
diff --git a/nova/tests/unit/api/openstack/compute/test_create_backup.py b/nova/tests/unit/api/openstack/compute/test_create_backup.py
index afb4c4811f..f7280a5a37 100644
--- a/nova/tests/unit/api/openstack/compute/test_create_backup.py
+++ b/nova/tests/unit/api/openstack/compute/test_create_backup.py
@@ -15,7 +15,6 @@
import mock
from oslo_utils import timeutils
-import six
import webob
from nova.api.openstack import common
@@ -393,7 +392,7 @@ class CreateBackupTestsV21(admin_only_action_common.CommonMixin,
mock_check_image.assert_called_once_with(self.context, {})
mock_is_volume_backed.assert_called_once_with(self.context, instance)
self.assertIn('Backup is not supported for volume-backed instances',
- six.text_type(ex))
+ str(ex))
class CreateBackupTestsV239(test.NoDBTestCase):
diff --git a/nova/tests/unit/api/openstack/compute/test_evacuate.py b/nova/tests/unit/api/openstack/compute/test_evacuate.py
index bf74e55db7..a9a55965a7 100644
--- a/nova/tests/unit/api/openstack/compute/test_evacuate.py
+++ b/nova/tests/unit/api/openstack/compute/test_evacuate.py
@@ -15,7 +15,6 @@
import fixtures
import mock
from oslo_utils.fixture import uuidsentinel as uuids
-import six
import testtools
import webob
@@ -390,7 +389,7 @@ class EvacuateTestV268(EvacuateTestV229):
ex = self._check_evacuate_failure(self.validation_error,
{'host': 'my-host',
'force': 'true'})
- self.assertIn('force', six.text_type(ex))
+ self.assertIn('force', str(ex))
def test_forced_evacuate_with_no_host_provided(self):
# not applicable for v2.68, which removed the 'force' parameter
diff --git a/nova/tests/unit/api/openstack/compute/test_flavor_manage.py b/nova/tests/unit/api/openstack/compute/test_flavor_manage.py
index 5950a9b230..e6e1c8e26a 100644
--- a/nova/tests/unit/api/openstack/compute/test_flavor_manage.py
+++ b/nova/tests/unit/api/openstack/compute/test_flavor_manage.py
@@ -17,7 +17,6 @@ import copy
import mock
from oslo_serialization import jsonutils
-import six
import webob
from nova.api.openstack.compute import flavor_access as flavor_access_v21
@@ -74,7 +73,7 @@ class FlavorManageTestV21(test.NoDBTestCase):
"vcpus": 2,
"disk": 1,
"OS-FLV-EXT-DATA:ephemeral": 1,
- "id": six.text_type('1234'),
+ "id": '1234',
"swap": 512,
"rxtx_factor": 1,
"os-flavor-access:is_public": True,
@@ -117,7 +116,7 @@ class FlavorManageTestV21(test.NoDBTestCase):
"vcpus": 2,
"disk": 1,
"OS-FLV-EXT-DATA:ephemeral": 1,
- "id": six.text_type('1234'),
+ "id": '1234',
"swap": 512,
"rxtx_factor": 1,
"os-flavor-access:is_public": True,
@@ -343,7 +342,7 @@ class FlavorManageTestV21(test.NoDBTestCase):
ex = self.assertRaises(
self.validation_error, self.controller._create,
self._get_http_request(), body=self.request_body)
- self.assertIn('description', six.text_type(ex))
+ self.assertIn('description', str(ex))
def test_flavor_update_description(self):
"""With microversion <2.55 this should return a failure."""
diff --git a/nova/tests/unit/api/openstack/compute/test_hypervisors.py b/nova/tests/unit/api/openstack/compute/test_hypervisors.py
index 4a153b7a36..95fc822326 100644
--- a/nova/tests/unit/api/openstack/compute/test_hypervisors.py
+++ b/nova/tests/unit/api/openstack/compute/test_hypervisors.py
@@ -19,7 +19,6 @@ import mock
import netaddr
from oslo_serialization import jsonutils
from oslo_utils.fixture import uuidsentinel as uuids
-import six
from webob import exc
from nova.api.openstack.compute import hypervisors \
@@ -1024,7 +1023,7 @@ class HypervisorsTestV253(HypervisorsTestV252):
ex = self.assertRaises(exc.HTTPBadRequest, self.controller.index, req)
self.assertIn('Paging over hypervisors with the '
'hypervisor_hostname_pattern query parameter is not '
- 'supported.', six.text_type(ex))
+ 'supported.', str(ex))
def test_servers_with_non_integer_hypervisor_id(self):
"""This is a poorly named test, it's really checking the 404 case where
@@ -1134,7 +1133,7 @@ class HypervisorsTestV253(HypervisorsTestV252):
req = self._get_request(True)
ex = self.assertRaises(exc.HTTPBadRequest,
self.controller.show, req, '1')
- self.assertIn('Invalid uuid 1', six.text_type(ex))
+ self.assertIn('Invalid uuid 1', str(ex))
def test_show_with_servers_invalid_parameter(self):
"""Tests passing an invalid value for the with_servers query parameter
@@ -1146,7 +1145,7 @@ class HypervisorsTestV253(HypervisorsTestV252):
url='/os-hypervisors/%s?with_servers=invalid' % hyper_id)
ex = self.assertRaises(
exception.ValidationError, self.controller.show, req, hyper_id)
- self.assertIn('with_servers', six.text_type(ex))
+ self.assertIn('with_servers', str(ex))
def test_show_with_servers_host_mapping_not_found(self):
"""Tests that a 404 is returned if instance_get_all_by_host raises
@@ -1195,7 +1194,7 @@ class HypervisorsTestV253(HypervisorsTestV252):
req = self._get_request(True)
ex = self.assertRaises(exc.HTTPBadRequest,
self.controller.uptime, req, '1')
- self.assertIn('Invalid uuid 1', six.text_type(ex))
+ self.assertIn('Invalid uuid 1', str(ex))
def test_detail_pagination(self):
"""Tests details paging with uuid markers."""
diff --git a/nova/tests/unit/api/openstack/compute/test_instance_actions.py b/nova/tests/unit/api/openstack/compute/test_instance_actions.py
index 503ab1f6c1..fc6fd0d211 100644
--- a/nova/tests/unit/api/openstack/compute/test_instance_actions.py
+++ b/nova/tests/unit/api/openstack/compute/test_instance_actions.py
@@ -20,7 +20,6 @@ import iso8601
import mock
from oslo_policy import policy as oslo_policy
from oslo_utils.fixture import uuidsentinel as uuids
-import six
from webob import exc
from nova.api.openstack.compute import instance_actions as instance_actions_v21
@@ -273,7 +272,7 @@ class InstanceActionsTestV258(InstanceActionsTestV251):
ex = self.assertRaises(exception.ValidationError,
self.controller.index, req)
self.assertIn('Invalid input for query parameters changes-since',
- six.text_type(ex))
+ str(ex))
def test_get_action_with_invalid_params(self):
"""Tests get paging with a invalid change_since."""
@@ -281,16 +280,14 @@ class InstanceActionsTestV258(InstanceActionsTestV251):
'wrong_params=xxx')
ex = self.assertRaises(exception.ValidationError,
self.controller.index, req)
- self.assertIn('Additional properties are not allowed',
- six.text_type(ex))
+ self.assertIn('Additional properties are not allowed', str(ex))
def test_get_action_with_multi_params(self):
"""Tests get paging with multi markers."""
req = self._get_http_req('os-instance-actions?marker=A&marker=B')
ex = self.assertRaises(exception.ValidationError,
self.controller.index, req)
- self.assertIn('Invalid input for query parameters marker',
- six.text_type(ex))
+ self.assertIn('Invalid input for query parameters marker', str(ex))
class InstanceActionsTestV262(InstanceActionsTestV258):
@@ -367,7 +364,7 @@ class InstanceActionsTestV266(InstanceActionsTestV258):
ex = self.assertRaises(exception.ValidationError,
self.controller.index, req)
self.assertIn('Invalid input for query parameters changes-before',
- six.text_type(ex))
+ str(ex))
@mock.patch('nova.compute.api.InstanceActionAPI.actions_get')
@mock.patch('nova.api.openstack.common.get_instance')
@@ -401,7 +398,7 @@ class InstanceActionsTestV266(InstanceActionsTestV258):
ex = self.assertRaises(exc.HTTPBadRequest, self.controller.index,
req, FAKE_UUID)
self.assertIn('The value of changes-since must be less than '
- 'or equal to changes-before', six.text_type(ex))
+ 'or equal to changes-before', str(ex))
def test_get_action_with_changes_before_old_microversion(self):
"""Tests that the changes-before query parameter is an error before
@@ -414,7 +411,7 @@ class InstanceActionsTestV266(InstanceActionsTestV258):
ex = self.assertRaises(exception.ValidationError,
self.controller.index, req)
detail = 'Additional properties are not allowed'
- self.assertIn(detail, six.text_type(ex))
+ self.assertIn(detail, str(ex))
class InstanceActionsTestV284(InstanceActionsTestV266):
diff --git a/nova/tests/unit/api/openstack/compute/test_lock_server.py b/nova/tests/unit/api/openstack/compute/test_lock_server.py
index c5bed64cc5..a605e2bcdb 100644
--- a/nova/tests/unit/api/openstack/compute/test_lock_server.py
+++ b/nova/tests/unit/api/openstack/compute/test_lock_server.py
@@ -14,7 +14,6 @@
# under the License.
import mock
-import six
from nova.api.openstack import api_version_request
from nova.api.openstack import common
@@ -103,7 +102,7 @@ class LockServerTestsV273(LockServerTestsV21):
exp = self.assertRaises(exception.ValidationError,
self.controller._lock, self.req, instance.uuid, body=body)
- self.assertIn('is too long', six.text_type(exp))
+ self.assertIn('is too long', str(exp))
def test_lock_with_reason_in_invalid_format(self):
instance = fake_instance.fake_instance_obj(
@@ -113,7 +112,7 @@ class LockServerTestsV273(LockServerTestsV21):
exp = self.assertRaises(exception.ValidationError,
self.controller._lock, self.req, instance.uuid, body=body)
- self.assertIn("256 is not of type 'string'", six.text_type(exp))
+ self.assertIn("256 is not of type 'string'", str(exp))
def test_lock_with_invalid_paramater(self):
# This will fail from 2.73 since we have a schema check that allows
@@ -124,4 +123,4 @@ class LockServerTestsV273(LockServerTestsV21):
exp = self.assertRaises(exception.ValidationError,
self.controller._lock, self.req, instance.uuid, body=body)
- self.assertIn("('blah' was unexpected)", six.text_type(exp))
+ self.assertIn("('blah' was unexpected)", str(exp))
diff --git a/nova/tests/unit/api/openstack/compute/test_migrate_server.py b/nova/tests/unit/api/openstack/compute/test_migrate_server.py
index 632b7c7cff..5928fe3e56 100644
--- a/nova/tests/unit/api/openstack/compute/test_migrate_server.py
+++ b/nova/tests/unit/api/openstack/compute/test_migrate_server.py
@@ -17,7 +17,6 @@ import fixtures
import mock
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import uuidutils
-import six
import webob
from nova.api.openstack import api_version_request
@@ -226,7 +225,7 @@ class MigrateServerTestsV21(admin_only_action_common.CommonTests):
self.controller._migrate_live,
self.req, instance.uuid, body=body)
if check_response:
- self.assertIn(six.text_type(fake_exc), ex.explanation)
+ self.assertIn(str(fake_exc), ex.explanation)
mock_live_migrate.assert_called_once_with(
self.context, instance, False, self.disk_over_commit,
'hostname', self.force, self.async_)
@@ -601,7 +600,7 @@ class MigrateServerTestsV268(MigrateServerTestsV256):
self.req, fakes.FAKE_UUID, body=body)
self.assertIn("Operation 'live-migration' not supported for "
"SEV-enabled instance (%s)" % instance.uuid,
- six.text_type(ex))
+ str(ex))
def test_live_migrate_with_forced_host(self):
body = {'os-migrateLive': {'host': 'hostname',
@@ -610,4 +609,4 @@ class MigrateServerTestsV268(MigrateServerTestsV256):
ex = self.assertRaises(self.validation_error,
self.controller._migrate_live,
self.req, fakes.FAKE_UUID, body=body)
- self.assertIn('force', six.text_type(ex))
+ self.assertIn('force', str(ex))
diff --git a/nova/tests/unit/api/openstack/compute/test_migrations.py b/nova/tests/unit/api/openstack/compute/test_migrations.py
index edd1197a75..a06d395bea 100644
--- a/nova/tests/unit/api/openstack/compute/test_migrations.py
+++ b/nova/tests/unit/api/openstack/compute/test_migrations.py
@@ -17,7 +17,6 @@ import datetime
import iso8601
import mock
from oslo_utils.fixture import uuidsentinel as uuids
-import six
from webob import exc
from nova.api.openstack.compute import migrations as migrations_v21
@@ -314,7 +313,7 @@ class MigrationsTestCaseV259(MigrationsTestCaseV223):
self.controller.index, req)
self.assertEqual(
"Marker %s could not be found." % uuids.invalid_marker,
- six.text_type(e))
+ str(e))
def test_index_with_invalid_limit(self):
"""Tests detail paging with an invalid limit."""
@@ -344,8 +343,7 @@ class MigrationsTestCaseV259(MigrationsTestCaseV223):
version=self.wsgi_api_version, use_admin_context=True)
ex = self.assertRaises(exception.ValidationError,
self.controller.index, req)
- self.assertIn('Additional properties are not allowed',
- six.text_type(ex))
+ self.assertIn('Additional properties are not allowed', str(ex))
@mock.patch('nova.compute.api.API.get_migrations',
return_value=objects.MigrationList())
@@ -413,7 +411,7 @@ class MigrationTestCaseV266(MigrationsTestCaseV259):
use_admin_context=True)
ex = self.assertRaises(exc.HTTPBadRequest, self.controller.index, req)
self.assertIn('The value of changes-since must be less than '
- 'or equal to changes-before', six.text_type(ex))
+ 'or equal to changes-before', str(ex))
def test_index_with_changes_before_old_microversion_failed(self):
"""Tests that the changes-before query parameter is an error before
@@ -427,8 +425,7 @@ class MigrationTestCaseV266(MigrationsTestCaseV259):
version='2.65', use_admin_context=True)
ex = self.assertRaises(exception.ValidationError,
self.controller.index, req)
- self.assertIn('Additional properties are not allowed',
- six.text_type(ex))
+ self.assertIn('Additional properties are not allowed', str(ex))
@mock.patch('nova.compute.api.API.get_migrations',
return_value=objects.MigrationList())
@@ -490,8 +487,7 @@ class MigrationsTestCaseV280(MigrationTestCaseV266):
version='2.79', use_admin_context=True)
ex = self.assertRaises(exception.ValidationError,
self.controller.index, req)
- self.assertIn('Additional properties are not allowed',
- six.text_type(ex))
+ self.assertIn('Additional properties are not allowed', str(ex))
def test_index_filter_by_project_id_pre_v280(self):
"""Tests that the migrations by project_id query parameter
@@ -502,5 +498,4 @@ class MigrationsTestCaseV280(MigrationTestCaseV266):
version='2.79', use_admin_context=True)
ex = self.assertRaises(exception.ValidationError,
self.controller.index, req)
- self.assertIn('Additional properties are not allowed',
- six.text_type(ex))
+ self.assertIn('Additional properties are not allowed', str(ex))
diff --git a/nova/tests/unit/api/openstack/compute/test_server_external_events.py b/nova/tests/unit/api/openstack/compute/test_server_external_events.py
index ce042b5442..2ca97fc6d8 100644
--- a/nova/tests/unit/api/openstack/compute/test_server_external_events.py
+++ b/nova/tests/unit/api/openstack/compute/test_server_external_events.py
@@ -15,7 +15,6 @@
import fixtures as fx
import mock
from oslo_utils.fixture import uuidsentinel as uuids
-import six
from nova.api.openstack.compute import server_external_events \
as server_external_events_v21
@@ -260,8 +259,7 @@ class ServerExternalEventsTestV276(ServerExternalEventsTestV21):
self.api.create,
req,
body=body)
- self.assertIn('Invalid input for field/attribute name.',
- six.text_type(exp))
+ self.assertIn('Invalid input for field/attribute name.', str(exp))
@mock.patch('nova.objects.InstanceMappingList.get_by_instance_uuids',
diff --git a/nova/tests/unit/api/openstack/compute/test_server_groups.py b/nova/tests/unit/api/openstack/compute/test_server_groups.py
index a5fa299858..e7626ee733 100644
--- a/nova/tests/unit/api/openstack/compute/test_server_groups.py
+++ b/nova/tests/unit/api/openstack/compute/test_server_groups.py
@@ -17,7 +17,6 @@ import copy
import mock
from oslo_utils.fixture import uuidsentinel
from oslo_utils import uuidutils
-import six
import webob
from nova.api.openstack import api_version_request as avr
@@ -139,7 +138,7 @@ class ServerGroupTestV21(test.NoDBTestCase):
req, body={'server_group': sgroup})
self.assertIn(
"Invalid input for field/attribute server_group",
- six.text_type(result)
+ str(result)
)
# 'rules' isn't an acceptable request key before 2.64
sgroup = server_group_template(rules=rules)
@@ -148,7 +147,7 @@ class ServerGroupTestV21(test.NoDBTestCase):
req, body={'server_group': sgroup})
self.assertIn(
"Invalid input for field/attribute server_group",
- six.text_type(result)
+ str(result)
)
def test_create_server_group(self):
@@ -772,8 +771,7 @@ class ServerGroupTestV264(ServerGroupTestV213):
rules={'max_server_per_host': 3})
result = self.assertRaises(webob.exc.HTTPBadRequest,
self.controller.create, req, body={'server_group': sgroup})
- self.assertIn("Only anti-affinity policy supports rules",
- six.text_type(result))
+ self.assertIn("Only anti-affinity policy supports rules", str(result))
def test_create_anti_affinity_server_group_with_invalid_rules(self):
req = fakes.HTTPRequest.blank('', version=self.wsgi_api_version)
@@ -789,7 +787,7 @@ class ServerGroupTestV264(ServerGroupTestV213):
self.validation_error, self.controller.create,
req, body={'server_group': sgroup})
self.assertIn(
- "Invalid input for field/attribute", six.text_type(result)
+ "Invalid input for field/attribute", str(result)
)
@mock.patch('nova.objects.service.get_minimum_version_all_cells',
@@ -804,7 +802,7 @@ class ServerGroupTestV264(ServerGroupTestV213):
self.controller.create, req, body={'server_group': sgroup})
self.assertIn("Creating an anti-affinity group with rule "
"max_server_per_host > 1 is not yet supported.",
- six.text_type(result))
+ str(result))
def test_create_server_group(self):
policies = ['affinity', 'anti-affinity']
diff --git a/nova/tests/unit/api/openstack/compute/test_server_start_stop.py b/nova/tests/unit/api/openstack/compute/test_server_start_stop.py
index f3d8ba72bc..eb7be448f5 100644
--- a/nova/tests/unit/api/openstack/compute/test_server_start_stop.py
+++ b/nova/tests/unit/api/openstack/compute/test_server_start_stop.py
@@ -15,7 +15,6 @@
import mock
from oslo_policy import policy as oslo_policy
from oslo_utils.fixture import uuidsentinel as uuids
-import six
import webob
from nova.api.openstack.compute import servers \
@@ -72,7 +71,7 @@ class ServerStartStopTestV21(test.TestCase):
body = dict(start="")
ex = self.assertRaises(webob.exc.HTTPConflict,
self.controller._start_server, self.req, uuids.instance, body)
- self.assertIn('is locked', six.text_type(ex))
+ self.assertIn('is locked', str(ex))
@mock.patch.object(compute_api.API, 'stop')
def test_stop(self, stop_mock):
@@ -95,7 +94,7 @@ class ServerStartStopTestV21(test.TestCase):
body = dict(stop="")
ex = self.assertRaises(webob.exc.HTTPConflict,
self.controller._stop_server, self.req, uuids.instance, body)
- self.assertIn('is locked', six.text_type(ex))
+ self.assertIn('is locked', str(ex))
@mock.patch.object(compute_api.API, 'stop',
side_effect=exception.InstanceIsLocked(
diff --git a/nova/tests/unit/api/openstack/compute/test_servers.py b/nova/tests/unit/api/openstack/compute/test_servers.py
index 6486110d3d..b384c73f36 100644
--- a/nova/tests/unit/api/openstack/compute/test_servers.py
+++ b/nova/tests/unit/api/openstack/compute/test_servers.py
@@ -32,7 +32,6 @@ from oslo_utils import fixture as utils_fixture
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import timeutils
from oslo_utils import uuidutils
-import six
import testtools
import webob
@@ -311,7 +310,7 @@ class ServersControllerTest(ControllerTest):
self.controller._get_requested_networks,
requested_networks)
self.assertIn('Bad networks format: network uuid is not in proper '
- 'format', six.text_type(ex))
+ 'format', str(ex))
def test_requested_networks_enabled_with_port(self):
port = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee'
@@ -2620,7 +2619,7 @@ class ServersControllerTestV273(ControllerTest):
req = self.req(self.path_with_query % 'locked=price')
exp = self.assertRaises(webob.exc.HTTPBadRequest,
self.controller.index, req)
- self.assertIn("Unrecognized value 'price'", six.text_type(exp))
+ self.assertIn("Unrecognized value 'price'", str(exp))
def test_get_servers_with_locked_filter_empty_value(self):
def fake_get_all(context, search_opts=None,
@@ -2637,7 +2636,7 @@ class ServersControllerTestV273(ControllerTest):
req = self.req(self.path_with_query % 'locked=')
exp = self.assertRaises(webob.exc.HTTPBadRequest,
self.controller.index, req)
- self.assertIn("Unrecognized value ''", six.text_type(exp))
+ self.assertIn("Unrecognized value ''", str(exp))
def test_get_servers_with_locked_sort_key(self):
def fake_get_all(context, search_opts=None,
@@ -3331,7 +3330,7 @@ class ServersControllerRebuildTestV254(ServersControllerRebuildInstanceTest):
excpt = self.assertRaises(exception.ValidationError,
self.controller._action_rebuild,
self.req, FAKE_UUID, body=body)
- self.assertIn('key_name', six.text_type(excpt))
+ self.assertIn('key_name', str(excpt))
def test_rebuild_with_not_existed_keypair_name(self):
body = {
@@ -3445,7 +3444,7 @@ class ServersControllerRebuildTestV257(ServersControllerRebuildTestV254):
ex = self.assertRaises(exception.ValidationError,
self.controller._action_rebuild,
self.req, FAKE_UUID, body=body)
- self.assertIn('personality', six.text_type(ex))
+ self.assertIn('personality', str(ex))
def test_rebuild_user_data_old_version(self):
"""Tests that trying to rebuild with user_data before 2.57 fails."""
@@ -3460,7 +3459,7 @@ class ServersControllerRebuildTestV257(ServersControllerRebuildTestV254):
ex = self.assertRaises(exception.ValidationError,
self.controller._action_rebuild,
self.req, FAKE_UUID, body=body)
- self.assertIn('user_data', six.text_type(ex))
+ self.assertIn('user_data', str(ex))
def test_rebuild_user_data_malformed(self):
"""Tests that trying to rebuild with malformed user_data fails."""
@@ -3473,7 +3472,7 @@ class ServersControllerRebuildTestV257(ServersControllerRebuildTestV254):
ex = self.assertRaises(exception.ValidationError,
self.controller._action_rebuild,
self.req, FAKE_UUID, body=body)
- self.assertIn('user_data', six.text_type(ex))
+ self.assertIn('user_data', str(ex))
def test_rebuild_user_data_too_large(self):
"""Tests that passing user_data to rebuild that is too large fails."""
@@ -3486,7 +3485,7 @@ class ServersControllerRebuildTestV257(ServersControllerRebuildTestV254):
ex = self.assertRaises(exception.ValidationError,
self.controller._action_rebuild,
self.req, FAKE_UUID, body=body)
- self.assertIn('user_data', six.text_type(ex))
+ self.assertIn('user_data', str(ex))
@mock.patch.object(context.RequestContext, 'can')
@mock.patch('nova.db.api.instance_update_and_get_original')
@@ -3660,7 +3659,7 @@ class ServersControllerRebuildTestV263(ControllerTest):
ex = self.assertRaises(exception.ValidationError,
self.controller._action_rebuild,
self.req, FAKE_UUID, body=self.body)
- self.assertIn('is too short', six.text_type(ex))
+ self.assertIn('is too short', str(ex))
def test_rebuild_server_with_empty_trusted_certs(self):
"""Make sure that we can't rebuild with an empty array of IDs"""
@@ -3669,7 +3668,7 @@ class ServersControllerRebuildTestV263(ControllerTest):
ex = self.assertRaises(exception.ValidationError,
self.controller._action_rebuild,
self.req, FAKE_UUID, body=self.body)
- self.assertIn('is too short', six.text_type(ex))
+ self.assertIn('is too short', str(ex))
def test_rebuild_server_with_too_many_trusted_certs(self):
"""Make sure that we can't rebuild with an array of >50 unique IDs"""
@@ -3679,7 +3678,7 @@ class ServersControllerRebuildTestV263(ControllerTest):
ex = self.assertRaises(exception.ValidationError,
self.controller._action_rebuild,
self.req, FAKE_UUID, body=self.body)
- self.assertIn('is too long', six.text_type(ex))
+ self.assertIn('is too long', str(ex))
def test_rebuild_server_with_nonunique_trusted_certs(self):
"""Make sure that we can't rebuild with a non-unique array of IDs"""
@@ -3688,7 +3687,7 @@ class ServersControllerRebuildTestV263(ControllerTest):
ex = self.assertRaises(exception.ValidationError,
self.controller._action_rebuild,
self.req, FAKE_UUID, body=self.body)
- self.assertIn('has non-unique elements', six.text_type(ex))
+ self.assertIn('has non-unique elements', str(ex))
def test_rebuild_server_with_invalid_trusted_cert_id(self):
"""Make sure that we can't rebuild with non-string certificate IDs"""
@@ -3697,7 +3696,7 @@ class ServersControllerRebuildTestV263(ControllerTest):
ex = self.assertRaises(exception.ValidationError,
self.controller._action_rebuild,
self.req, FAKE_UUID, body=self.body)
- self.assertIn('is not of type', six.text_type(ex))
+ self.assertIn('is not of type', str(ex))
def test_rebuild_server_with_invalid_trusted_certs(self):
"""Make sure that we can't rebuild with certificates in a non-array"""
@@ -3706,7 +3705,7 @@ class ServersControllerRebuildTestV263(ControllerTest):
ex = self.assertRaises(exception.ValidationError,
self.controller._action_rebuild,
self.req, FAKE_UUID, body=self.body)
- self.assertIn('is not of type', six.text_type(ex))
+ self.assertIn('is not of type', str(ex))
def test_rebuild_server_with_trusted_certs_pre_2_63_fails(self):
"""Make sure we can't use trusted_certs before 2.63"""
@@ -3716,8 +3715,7 @@ class ServersControllerRebuildTestV263(ControllerTest):
ex = self.assertRaises(exception.ValidationError,
self.controller._action_rebuild,
self.req, FAKE_UUID, body=self.body)
- self.assertIn('Additional properties are not allowed',
- six.text_type(ex))
+ self.assertIn('Additional properties are not allowed', str(ex))
def test_rebuild_server_with_trusted_certs_policy_failed(self):
rule_name = "os_compute_api:servers:rebuild:trusted_certs"
@@ -3740,8 +3738,7 @@ class ServersControllerRebuildTestV263(ControllerTest):
ex = self.assertRaises(webob.exc.HTTPBadRequest,
self._rebuild_server,
certs=['trusted-cert-id'])
- self.assertIn('test cert validation error',
- six.text_type(ex))
+ self.assertIn('test cert validation error', str(ex))
class ServersControllerRebuildTestV271(ControllerTest):
@@ -4335,7 +4332,7 @@ class ServersControllerCreateTest(test.TestCase):
ex = self.assertRaises(webob.exc.HTTPBadRequest,
self._test_create_instance,
flavor=1324)
- self.assertEqual('Flavor 1324 could not be found.', six.text_type(ex))
+ self.assertEqual('Flavor 1324 could not be found.', str(ex))
def test_create_server_bad_image_uuid(self):
self.body['server']['min_count'] = 1
@@ -4447,7 +4444,7 @@ class ServersControllerCreateTest(test.TestCase):
self.controller.create,
self.req, body=self.body)
# Make sure the failure was about user_data and not something else.
- self.assertIn('user_data', six.text_type(ex))
+ self.assertIn('user_data', str(ex))
@mock.patch.object(compute_api.API, 'create',
side_effect=exception.NetworkRequiresSubnet(
@@ -6343,7 +6340,7 @@ class ServersControllerCreateTest(test.TestCase):
# Tests that PciRequestAliasNotDefined is translated to a 400 error.
ex = self.assertRaises(webob.exc.HTTPBadRequest,
self._test_create_extra, {})
- self.assertIn('PCI alias fake_name is not defined', six.text_type(ex))
+ self.assertIn('PCI alias fake_name is not defined', str(ex))
@mock.patch.object(compute_api.API, 'create',
side_effect=exception.PciInvalidAlias(
@@ -6352,7 +6349,7 @@ class ServersControllerCreateTest(test.TestCase):
# Tests that PciInvalidAlias is translated to a 400 error.
ex = self.assertRaises(webob.exc.HTTPBadRequest,
self._test_create_extra, {})
- self.assertIn('Invalid PCI alias definition', six.text_type(ex))
+ self.assertIn('Invalid PCI alias definition', str(ex))
def test_create_instance_with_user_data(self):
value = base64.encode_as_text("A random string")
@@ -6577,7 +6574,7 @@ class ServersControllerCreateTestV237(test.NoDBTestCase):
ex = self.assertRaises(
webob.exc.HTTPBadRequest, self._create_server, 'auto')
# make sure it was a flavor not found error and not something else
- self.assertIn('Flavor 2 could not be found', six.text_type(ex))
+ self.assertIn('Flavor 2 could not be found', str(ex))
@mock.patch.object(objects.Flavor, 'get_by_flavor_id',
side_effect=exception.FlavorNotFound(flavor_id='2'))
@@ -6589,7 +6586,7 @@ class ServersControllerCreateTestV237(test.NoDBTestCase):
ex = self.assertRaises(
webob.exc.HTTPBadRequest, self._create_server, 'none')
# make sure it was a flavor not found error and not something else
- self.assertIn('Flavor 2 could not be found', six.text_type(ex))
+ self.assertIn('Flavor 2 could not be found', str(ex))
@mock.patch.object(objects.Flavor, 'get_by_flavor_id',
side_effect=exception.FlavorNotFound(flavor_id='2'))
@@ -6604,7 +6601,7 @@ class ServersControllerCreateTestV237(test.NoDBTestCase):
[{'uuid': 'e3b686a8-b91d-4a61-a3fc-1b74bb619ddb'},
{'uuid': 'e0f00941-f85f-46ec-9315-96ded58c2f14'}])
# make sure it was a flavor not found error and not something else
- self.assertIn('Flavor 2 could not be found', six.text_type(ex))
+ self.assertIn('Flavor 2 could not be found', str(ex))
def test_create_server_legacy_neutron_network_id_fails(self):
"""Tests that we no longer support the legacy br-<uuid> format for
@@ -6688,7 +6685,7 @@ class ServersControllerCreateTestV257(test.NoDBTestCase):
req.headers['content-type'] = 'application/json'
ex = self.assertRaises(
exception.ValidationError, controller.create, req, body=body)
- self.assertIn('personality', six.text_type(ex))
+ self.assertIn('personality', str(ex))
@mock.patch('nova.compute.utils.check_num_instances_quota',
@@ -6745,7 +6742,7 @@ class ServersControllerCreateTestV260(test.NoDBTestCase):
ex = self.assertRaises(webob.exc.HTTPBadRequest,
self._post_server, '2.59')
self.assertIn('Multiattach volumes are only supported starting with '
- 'compute API version 2.60', six.text_type(ex))
+ 'compute API version 2.60', str(ex))
class ServersControllerCreateTestV263(ServersControllerCreateTest):
@@ -6779,7 +6776,7 @@ class ServersControllerCreateTestV263(ServersControllerCreateTest):
ex = self.assertRaises(
exception.ValidationError, self.controller.create, self.req,
body=self.body)
- self.assertIn('is too short', six.text_type(ex))
+ self.assertIn('is too short', str(ex))
def test_create_instance_with_empty_trusted_certs(self):
"""Make sure we can't create with an empty array of IDs"""
@@ -6790,7 +6787,7 @@ class ServersControllerCreateTestV263(ServersControllerCreateTest):
ex = self.assertRaises(
exception.ValidationError, self.controller.create, self.req,
body=self.body)
- self.assertIn('is too short', six.text_type(ex))
+ self.assertIn('is too short', str(ex))
def test_create_instance_with_too_many_trusted_certs(self):
"""Make sure we can't create with an array of >50 unique IDs"""
@@ -6798,7 +6795,7 @@ class ServersControllerCreateTestV263(ServersControllerCreateTest):
ex = self.assertRaises(
exception.ValidationError, self.controller.create, self.req,
body=self.body)
- self.assertIn('is too long', six.text_type(ex))
+ self.assertIn('is too long', str(ex))
def test_create_instance_with_nonunique_trusted_certs(self):
"""Make sure we can't create with a non-unique array of IDs"""
@@ -6806,7 +6803,7 @@ class ServersControllerCreateTestV263(ServersControllerCreateTest):
ex = self.assertRaises(
exception.ValidationError, self.controller.create, self.req,
body=self.body)
- self.assertIn('has non-unique elements', six.text_type(ex))
+ self.assertIn('has non-unique elements', str(ex))
def test_create_instance_with_invalid_trusted_cert_id(self):
"""Make sure we can't create with non-string certificate IDs"""
@@ -6814,7 +6811,7 @@ class ServersControllerCreateTestV263(ServersControllerCreateTest):
ex = self.assertRaises(
exception.ValidationError, self.controller.create, self.req,
body=self.body)
- self.assertIn('is not of type', six.text_type(ex))
+ self.assertIn('is not of type', str(ex))
def test_create_instance_with_invalid_trusted_certs(self):
"""Make sure we can't create with certificates in a non-array"""
@@ -6822,7 +6819,7 @@ class ServersControllerCreateTestV263(ServersControllerCreateTest):
ex = self.assertRaises(
exception.ValidationError, self.controller.create, self.req,
body=self.body)
- self.assertIn('is not of type', six.text_type(ex))
+ self.assertIn('is not of type', str(ex))
def test_create_server_with_trusted_certs_pre_2_63_fails(self):
"""Make sure we can't use trusted_certs before 2.63"""
@@ -6832,8 +6829,7 @@ class ServersControllerCreateTestV263(ServersControllerCreateTest):
ex = self.assertRaises(
exception.ValidationError, self.controller.create, self.req,
body=self.body)
- self.assertIn('Additional properties are not allowed',
- six.text_type(ex))
+ self.assertIn('Additional properties are not allowed', str(ex))
def test_create_server_with_trusted_certs_policy_failed(self):
rule_name = "os_compute_api:servers:create:trusted_certs"
@@ -6861,8 +6857,7 @@ class ServersControllerCreateTestV263(ServersControllerCreateTest):
ex = self.assertRaises(webob.exc.HTTPBadRequest,
self.controller.create, self.req,
body=self.body)
- self.assertIn('test cert validation error',
- six.text_type(ex))
+ self.assertIn('test cert validation error', str(ex))
class ServersControllerCreateTestV267(ServersControllerCreateTest):
@@ -6894,7 +6889,7 @@ class ServersControllerCreateTestV267(ServersControllerCreateTest):
ex = self.assertRaises(
exception.ValidationError, self.controller.create, self.req,
body=self.body)
- self.assertIn("'volume_type' was unexpected", six.text_type(ex))
+ self.assertIn("'volume_type' was unexpected", str(ex))
@mock.patch.object(compute_api.API, 'create',
side_effect=exception.VolumeTypeNotFound(
@@ -6906,8 +6901,7 @@ class ServersControllerCreateTestV267(ServersControllerCreateTest):
params = {'block_device_mapping_v2': self.block_device_mapping_v2}
ex = self.assertRaises(webob.exc.HTTPBadRequest,
self._test_create_extra, params)
- self.assertIn('Volume type fake-lvm-1 could not be found',
- six.text_type(ex))
+ self.assertIn('Volume type fake-lvm-1 could not be found', str(ex))
def test_create_instance_with_volume_type_empty_string(self):
"""Test passing volume_type='' which is accepted but not used."""
@@ -6933,7 +6927,7 @@ class ServersControllerCreateTestV267(ServersControllerCreateTest):
params = {'block_device_mapping_v2': self.block_device_mapping_v2}
ex = self.assertRaises(exception.ValidationError,
self._test_create_extra, params)
- self.assertIn('is too long', six.text_type(ex))
+ self.assertIn('is too long', str(ex))
class ServersControllerCreateTestV274(ServersControllerCreateTest):
@@ -6965,8 +6959,7 @@ class ServersControllerCreateTestV274(ServersControllerCreateTest):
ex = self.assertRaises(webob.exc.HTTPBadRequest,
self.controller.create,
self.req, body=self.body)
- self.assertIn('Compute host node-invalid could not be found.',
- six.text_type(ex))
+ self.assertIn('Compute host node-invalid could not be found.', str(ex))
def test_create_instance_with_non_string_host(self):
self._generate_req(host=123)
@@ -6974,8 +6967,7 @@ class ServersControllerCreateTestV274(ServersControllerCreateTest):
ex = self.assertRaises(exception.ValidationError,
self.controller.create,
self.req, body=self.body)
- self.assertIn("Invalid input for field/attribute host.",
- six.text_type(ex))
+ self.assertIn("Invalid input for field/attribute host.", str(ex))
def test_create_instance_with_invalid_hypervisor_hostname(self):
get_resp = mock.Mock()
@@ -6987,8 +6979,7 @@ class ServersControllerCreateTestV274(ServersControllerCreateTest):
ex = self.assertRaises(webob.exc.HTTPBadRequest,
self.controller.create,
self.req, body=self.body)
- self.assertIn('Compute host node-invalid could not be found.',
- six.text_type(ex))
+ self.assertIn('Compute host node-invalid could not be found.', str(ex))
def test_create_instance_with_non_string_hypervisor_hostname(self):
get_resp = mock.Mock()
@@ -7001,7 +6992,7 @@ class ServersControllerCreateTestV274(ServersControllerCreateTest):
self.controller.create,
self.req, body=self.body)
self.assertIn("Invalid input for field/attribute hypervisor_hostname.",
- six.text_type(ex))
+ str(ex))
def test_create_instance_with_invalid_host_and_hypervisor_hostname(self):
self._generate_req(host='host-invalid', node='node-invalid')
@@ -7009,8 +7000,7 @@ class ServersControllerCreateTestV274(ServersControllerCreateTest):
ex = self.assertRaises(webob.exc.HTTPBadRequest,
self.controller.create,
self.req, body=self.body)
- self.assertIn('Compute host host-invalid could not be found.',
- six.text_type(ex))
+ self.assertIn('Compute host host-invalid could not be found.', str(ex))
def test_create_instance_with_non_string_host_and_hypervisor_hostname(
self):
@@ -7019,8 +7009,7 @@ class ServersControllerCreateTestV274(ServersControllerCreateTest):
ex = self.assertRaises(exception.ValidationError,
self.controller.create,
self.req, body=self.body)
- self.assertIn("Invalid input for field/attribute",
- six.text_type(ex))
+ self.assertIn("Invalid input for field/attribute", str(ex))
def test_create_instance_pre_274(self):
self._generate_req(host='host', node='node', api_version='2.73')
@@ -7028,8 +7017,7 @@ class ServersControllerCreateTestV274(ServersControllerCreateTest):
ex = self.assertRaises(exception.ValidationError,
self.controller.create,
self.req, body=self.body)
- self.assertIn("Invalid input for field/attribute server.",
- six.text_type(ex))
+ self.assertIn("Invalid input for field/attribute server.", str(ex))
def test_create_instance_mutual(self):
self._generate_req(host='host', node='node', az='nova:host:node')
@@ -7037,7 +7025,7 @@ class ServersControllerCreateTestV274(ServersControllerCreateTest):
ex = self.assertRaises(webob.exc.HTTPBadRequest,
self.controller.create,
self.req, body=self.body)
- self.assertIn("mutually exclusive", six.text_type(ex))
+ self.assertIn("mutually exclusive", str(ex))
def test_create_instance_private_flavor(self):
# Here we use admin context, so if we do not pass it or
diff --git a/nova/tests/unit/api/openstack/compute/test_services.py b/nova/tests/unit/api/openstack/compute/test_services.py
index 170b39f208..8d77ad0d9f 100644
--- a/nova/tests/unit/api/openstack/compute/test_services.py
+++ b/nova/tests/unit/api/openstack/compute/test_services.py
@@ -20,7 +20,6 @@ from keystoneauth1 import exceptions as ks_exc
import mock
from oslo_utils import fixture as utils_fixture
from oslo_utils.fixture import uuidsentinel
-import six
import webob.exc
from nova.api.openstack.compute import services as services_v21
@@ -1191,13 +1190,13 @@ class ServicesTestV253(test.TestCase):
"""Tests that the service uuid is validated in a DELETE request."""
ex = self.assertRaises(webob.exc.HTTPBadRequest,
self.controller.delete, self.req, 1234)
- self.assertIn('Invalid uuid', six.text_type(ex))
+ self.assertIn('Invalid uuid', str(ex))
def test_update_invalid_service_uuid(self):
"""Tests that the service uuid is validated in a PUT request."""
ex = self.assertRaises(webob.exc.HTTPBadRequest,
self.controller.update, self.req, 1234, body={})
- self.assertIn('Invalid uuid', six.text_type(ex))
+ self.assertIn('Invalid uuid', str(ex))
def test_update_policy_failed(self):
"""Tests that policy is checked with microversion 2.53."""
@@ -1270,7 +1269,7 @@ class ServicesTestV253(test.TestCase):
body={'status': 'enabled',
'disabled_reason': 'invalid'})
self.assertIn("Specifying 'disabled_reason' with status 'enabled' "
- "is invalid.", six.text_type(ex))
+ "is invalid.", str(ex))
def test_update_disabled_reason_and_forced_down(self):
"""Tests disabling a service with a reason and forcing it down is
@@ -1321,7 +1320,7 @@ class ServicesTestV253(test.TestCase):
body={'forced_down': True})
self.assertEqual('Updating a nova-scheduler service is not supported. '
'Only nova-compute services can be updated.',
- six.text_type(ex))
+ str(ex))
def test_update_empty_body(self):
"""Tests that the caller gets a 400 error if they don't request any
@@ -1333,7 +1332,7 @@ class ServicesTestV253(test.TestCase):
self.req, service.uuid, body={})
self.assertEqual("No updates were requested. Fields 'status' or "
"'forced_down' should be specified.",
- six.text_type(ex))
+ str(ex))
def test_update_only_disabled_reason(self):
"""Tests that the caller gets a 400 error if they only specify
@@ -1345,7 +1344,7 @@ class ServicesTestV253(test.TestCase):
body={'disabled_reason': 'missing status'})
self.assertEqual("No updates were requested. Fields 'status' or "
"'forced_down' should be specified.",
- six.text_type(ex))
+ str(ex))
class ServicesTestV275(test.TestCase):
diff --git a/nova/tests/unit/api/openstack/compute/test_shelve.py b/nova/tests/unit/api/openstack/compute/test_shelve.py
index 5a063aa7ed..9cf87d9c42 100644
--- a/nova/tests/unit/api/openstack/compute/test_shelve.py
+++ b/nova/tests/unit/api/openstack/compute/test_shelve.py
@@ -17,7 +17,6 @@ import mock
import ddt
from oslo_serialization import jsonutils
from oslo_utils.fixture import uuidsentinel as uuids
-import six
import webob
from nova.api.openstack import api_version_request
@@ -151,8 +150,7 @@ class UnshelveServerControllerTestV277(test.NoDBTestCase):
self.controller._unshelve,
self.req, fakes.FAKE_UUID,
body=body)
- self.assertIn("\'availability_zone\' is a required property",
- six.text_type(exc))
+ self.assertIn("\'availability_zone\' is a required property", str(exc))
def test_invalid_az_name_with_int(self):
body = {
@@ -187,5 +185,4 @@ class UnshelveServerControllerTestV277(test.NoDBTestCase):
exception.ValidationError,
self.controller._unshelve, self.req,
fakes.FAKE_UUID, body=body)
- self.assertIn("Additional properties are not allowed",
- six.text_type(exc))
+ self.assertIn("Additional properties are not allowed", str(exc))
diff --git a/nova/tests/unit/api/openstack/compute/test_suspend_server.py b/nova/tests/unit/api/openstack/compute/test_suspend_server.py
index 84fa0e9512..7d6857770e 100644
--- a/nova/tests/unit/api/openstack/compute/test_suspend_server.py
+++ b/nova/tests/unit/api/openstack/compute/test_suspend_server.py
@@ -13,7 +13,6 @@
# under the License.
import mock
-import six
import webob
from nova.api.openstack.compute import suspend_server as \
@@ -48,7 +47,7 @@ class SuspendServerTestsV21(admin_only_action_common.CommonTests):
self.controller._suspend,
self.req, fakes.FAKE_UUID, body={})
self.assertIn("Operation 'suspend' not supported for SEV-enabled "
- "instance (%s)" % instance.uuid, six.text_type(ex))
+ "instance (%s)" % instance.uuid, str(ex))
def test_suspend_resume_with_non_existed_instance(self):
self._test_actions_with_non_existed_instance(['_suspend', '_resume'])
diff --git a/nova/tests/unit/api/openstack/compute/test_volumes.py b/nova/tests/unit/api/openstack/compute/test_volumes.py
index 75f90bee3b..0e2fff58b4 100644
--- a/nova/tests/unit/api/openstack/compute/test_volumes.py
+++ b/nova/tests/unit/api/openstack/compute/test_volumes.py
@@ -22,7 +22,6 @@ import mock
from oslo_serialization import jsonutils
from oslo_utils import encodeutils
from oslo_utils.fixture import uuidsentinel as uuids
-import six
import webob
from webob import exc
@@ -949,7 +948,7 @@ class VolumeAttachTestsV260(test.NoDBTestCase):
create_kwargs = attach.call_args[1]
self.assertFalse(create_kwargs['supports_multiattach'])
self.assertIn('Multiattach volumes are only supported starting with '
- 'compute API version 2.60', six.text_type(ex))
+ 'compute API version 2.60', str(ex))
def test_attach_with_multiattach_fails_not_supported_by_driver(self):
"""Tests the case that the user tries to attach with a
@@ -966,7 +965,7 @@ class VolumeAttachTestsV260(test.NoDBTestCase):
create_kwargs = attach.call_args[1]
self.assertTrue(create_kwargs['supports_multiattach'])
self.assertIn("has 'multiattach' set, which is not supported for "
- "this instance", six.text_type(ex))
+ "this instance", str(ex))
def test_attach_with_multiattach_fails_for_shelved_offloaded_server(self):
"""Tests the case that the user tries to attach with a
@@ -981,7 +980,7 @@ class VolumeAttachTestsV260(test.NoDBTestCase):
create_kwargs = attach.call_args[1]
self.assertTrue(create_kwargs['supports_multiattach'])
self.assertIn('Attaching multiattach volumes is not supported for '
- 'shelved-offloaded instances.', six.text_type(ex))
+ 'shelved-offloaded instances.', str(ex))
class VolumeAttachTestsV2_75(VolumeAttachTestsV21):
@@ -1048,8 +1047,7 @@ class VolumeAttachTestsV279(VolumeAttachTestsV2_75):
ex = self.assertRaises(exception.ValidationError,
self.controller.create,
req, FAKE_UUID, body=body)
- self.assertIn("Additional properties are not allowed",
- six.text_type(ex))
+ self.assertIn("Additional properties are not allowed", str(ex))
@mock.patch('nova.compute.api.API.attach_volume', return_value=None)
def test_attach_volume_pre_v279(self, mock_attach_volume):
@@ -1089,7 +1087,7 @@ class VolumeAttachTestsV279(VolumeAttachTestsV2_75):
self.controller.create,
req, FAKE_UUID, body=body)
self.assertIn("Invalid input for field/attribute "
- "delete_on_termination.", six.text_type(ex))
+ "delete_on_termination.", str(ex))
def test_create_volume_attach_invalid_delete_on_termination_value(self):
""""Test the case that the user tries to set the delete_on_termination
@@ -1107,7 +1105,7 @@ class VolumeAttachTestsV279(VolumeAttachTestsV2_75):
self.controller.create,
req, FAKE_UUID, body=body)
self.assertIn("Invalid input for field/attribute "
- "delete_on_termination.", six.text_type(ex))
+ "delete_on_termination.", str(ex))
@mock.patch('nova.compute.api.API.attach_volume', return_value=None)
def test_attach_volume_v279(self, mock_attach_volume):
@@ -1397,8 +1395,7 @@ class UpdateVolumeAttachTests(VolumeAttachTestsV279):
self.attachments.update,
req, FAKE_UUID,
FAKE_UUID_A, body=body)
- self.assertIn('Additional properties are not allowed',
- six.text_type(ex))
+ self.assertIn('Additional properties are not allowed', str(ex))
@mock.patch.object(objects.BlockDeviceMapping,
'get_by_volume_and_instance')
@@ -1440,8 +1437,7 @@ class UpdateVolumeAttachTests(VolumeAttachTestsV279):
self.attachments.update,
req, FAKE_UUID,
FAKE_UUID_A, body=body)
- self.assertIn('Additional properties are not allowed',
- six.text_type(ex))
+ self.assertIn('Additional properties are not allowed', str(ex))
@mock.patch.object(objects.BlockDeviceMapping,
'get_by_volume_and_instance')
@@ -1479,8 +1475,7 @@ class UpdateVolumeAttachTests(VolumeAttachTestsV279):
self.attachments.update,
req, FAKE_UUID,
FAKE_UUID_A, body=body)
- self.assertIn('Additional properties are not allowed',
- six.text_type(ex))
+ self.assertIn('Additional properties are not allowed', str(ex))
@mock.patch.object(objects.BlockDeviceMapping,
'get_by_volume_and_instance')
@@ -1518,8 +1513,7 @@ class UpdateVolumeAttachTests(VolumeAttachTestsV279):
self.attachments.update,
req, FAKE_UUID,
FAKE_UUID_A, body=body)
- self.assertIn('Additional properties are not allowed',
- six.text_type(ex))
+ self.assertIn('Additional properties are not allowed', str(ex))
def test_update_volume_with_delete_flag_old_microversion(self):
body = {'volumeAttachment': {
@@ -1531,8 +1525,7 @@ class UpdateVolumeAttachTests(VolumeAttachTestsV279):
self.attachments.update,
req, FAKE_UUID,
FAKE_UUID_A, body=body)
- self.assertIn('Additional properties are not allowed',
- six.text_type(ex))
+ self.assertIn('Additional properties are not allowed', str(ex))
class SwapVolumeMultiattachTestCase(test.NoDBTestCase):
@@ -1603,7 +1596,7 @@ class SwapVolumeMultiattachTestCase(test.NoDBTestCase):
webob.exc.HTTPBadRequest, controller.update, req,
uuids.server1, uuids.old_vol_id, body=body)
self.assertIn('Swapping multi-attach volumes with more than one ',
- six.text_type(ex))
+ str(ex))
mock_attachment_get.assert_has_calls([
mock.call(ctxt, uuids.attachment_id1),
mock.call(ctxt, uuids.attachment_id2)], any_order=True)
@@ -1866,7 +1859,7 @@ class AssistedSnapshotDeleteTestCaseV21(test.NoDBTestCase):
self.controller.delete, req, '5')
# This is the result of a KeyError but the only thing in the message
# is the missing key.
- self.assertIn('volume_id', six.text_type(ex))
+ self.assertIn('volume_id', str(ex))
class AssistedSnapshotDeleteTestCaseV275(AssistedSnapshotDeleteTestCaseV21):
diff --git a/nova/tests/unit/api/openstack/test_common.py b/nova/tests/unit/api/openstack/test_common.py
index 8c85b79201..4666413e27 100644
--- a/nova/tests/unit/api/openstack/test_common.py
+++ b/nova/tests/unit/api/openstack/test_common.py
@@ -18,7 +18,6 @@ Test suites for 'common' code used throughout the OpenStack HTTP API.
"""
import mock
-import six
from testtools import matchers
import webob
import webob.exc
@@ -367,7 +366,7 @@ class MiscFunctionsTest(test.TestCase):
common.raise_http_conflict_for_instance_invalid_state(exc,
'meow', 'fake_server_id')
except webob.exc.HTTPConflict as e:
- self.assertEqual(six.text_type(e),
+ self.assertEqual(str(e),
"Cannot 'meow' instance fake_server_id while it is in "
"fake_attr fake_state")
else:
diff --git a/nova/tests/unit/compute/test_api.py b/nova/tests/unit/compute/test_api.py
index 8e9d651325..3daf97f404 100644
--- a/nova/tests/unit/compute/test_api.py
+++ b/nova/tests/unit/compute/test_api.py
@@ -27,7 +27,6 @@ from oslo_utils import fixture as utils_fixture
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import timeutils
from oslo_utils import uuidutils
-import six
from nova.compute import api as compute_api
from nova.compute import flavors
@@ -4579,7 +4578,7 @@ class _ComputeAPIUnitTestMixIn(object):
exception.MismatchVolumeAZException,
self.compute_api._validate_vol_az_for_create, None, volumes)
self.assertIn('Volumes are in different availability zones: 0,1',
- six.text_type(ex))
+ str(ex))
def test_validate_vol_az_for_create_vol_az_matches_default_cpu_az(self):
"""Tests the scenario that the instance is not being created in a
@@ -6131,7 +6130,7 @@ class _ComputeAPIUnitTestMixIn(object):
exp = self.assertRaises(exception.InstanceNotFound,
self.compute_api._get_instance_from_cell, self.context,
im, [], False)
- self.assertIn('could not be found', six.text_type(exp))
+ self.assertIn('could not be found', str(exp))
@mock.patch('nova.compute.api.API._save_user_id_in_instance_mapping')
@mock.patch.object(objects.RequestSpec, 'get_by_instance_uuid')
@@ -6156,13 +6155,13 @@ class _ComputeAPIUnitTestMixIn(object):
exp = self.assertRaises(exception.NovaException,
self.compute_api._get_instance_from_cell, self.context,
im1, [], False)
- self.assertIn('info is not available', six.text_type(exp))
+ self.assertIn('info is not available', str(exp))
# Have cell down support, error + queued_for_delete = NotFound
exp = self.assertRaises(exception.InstanceNotFound,
self.compute_api._get_instance_from_cell, self.context,
im1, [], True)
- self.assertIn('could not be found', six.text_type(exp))
+ self.assertIn('could not be found', str(exp))
# Have cell down support, error + archived reqspec = NotFound
mock_rs.side_effect = exception.RequestSpecNotFound(
@@ -6170,7 +6169,7 @@ class _ComputeAPIUnitTestMixIn(object):
exp = self.assertRaises(exception.InstanceNotFound,
self.compute_api._get_instance_from_cell, self.context,
im2, [], True)
- self.assertIn('could not be found', six.text_type(exp))
+ self.assertIn('could not be found', str(exp))
# Have cell down support, error + reqspec + not queued_for_delete
# means we return a minimal instance
diff --git a/nova/tests/unit/compute/test_compute.py b/nova/tests/unit/compute/test_compute.py
index 56c691e739..8f6cae721e 100644
--- a/nova/tests/unit/compute/test_compute.py
+++ b/nova/tests/unit/compute/test_compute.py
@@ -36,7 +36,6 @@ from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import timeutils
from oslo_utils import units
from oslo_utils import uuidutils
-import six
import testtools
from testtools import matchers as testtools_matchers
@@ -8968,7 +8967,7 @@ class ComputeAPITestCase(BaseTestCase):
self.compute_api.rebuild, self.context,
instance, self.fake_image['id'], 'new_password')
self.assertIn('Unable to find root block device mapping for '
- 'volume-backed instance', six.text_type(ex))
+ 'volume-backed instance', str(ex))
@mock.patch('nova.objects.RequestSpec')
def test_rebuild_with_deleted_image(self, mock_reqspec):
diff --git a/nova/tests/unit/compute/test_compute_mgr.py b/nova/tests/unit/compute/test_compute_mgr.py
index 1fd43ad474..df31336883 100644
--- a/nova/tests/unit/compute/test_compute_mgr.py
+++ b/nova/tests/unit/compute/test_compute_mgr.py
@@ -33,7 +33,6 @@ from oslo_service import fixture as service_fixture
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import timeutils
from oslo_utils import uuidutils
-import six
import testtools
import nova
@@ -1316,7 +1315,7 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase,
self._test__validate_pinning_configuration)
self.assertIn('This host has unpinned instances but has no CPUs '
'set aside for this purpose;',
- six.text_type(ex))
+ str(ex))
def test__validate_pinning_configuration_invalid_pinned_config(self):
"""Test that configuring only 'cpu_shared_set' when there are pinned
@@ -1329,7 +1328,7 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase,
self._test__validate_pinning_configuration)
self.assertIn('This host has pinned instances but has no CPUs '
'set aside for this purpose;',
- six.text_type(ex))
+ str(ex))
@mock.patch.object(manager.LOG, 'warning')
def test__validate_pinning_configuration_warning(self, mock_log):
@@ -1345,7 +1344,7 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase,
self.assertEqual(1, mock_log.call_count)
self.assertIn('Instance is pinned to host CPUs %(cpus)s '
'but one or more of these CPUs are not included in ',
- six.text_type(mock_log.call_args[0]))
+ str(mock_log.call_args[0]))
def test__validate_pinning_configuration_no_config(self):
"""Test that not configuring 'cpu_dedicated_set' or 'cpu_shared_set'
@@ -1357,7 +1356,7 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase,
self.assertIn("This host has mixed instance requesting both pinned "
"and unpinned CPUs but hasn't set aside unpinned CPUs "
"for this purpose;",
- six.text_type(ex))
+ str(ex))
def test__validate_pinning_configuration_not_supported(self):
"""Test that the entire check is skipped if the driver doesn't even
@@ -5533,8 +5532,7 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase,
allocations=self.allocations,
request_group_resource_providers_mapping=mock.sentinel.mapping,
accel_uuids=[])
- self.assertIn('Trusted image certificates provided on host',
- six.text_type(ex))
+ self.assertIn('Trusted image certificates provided on host', str(ex))
def test_reverts_task_state_instance_not_found(self):
# Tests that the reverts_task_state decorator in the compute manager
@@ -7461,7 +7459,7 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase):
ex = self.assertRaises(exception.InvalidBDM,
self.compute._prep_block_device,
self.context, self.instance, bdms)
- self.assertEqual('oops!', six.text_type(ex))
+ self.assertEqual('oops!', str(ex))
@mock.patch('nova.objects.InstanceGroup.get_by_hint')
def test_validate_policy_honors_workaround_disabled(self, mock_get):
@@ -9401,7 +9399,7 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase,
exception.MigrationError, self.compute._do_live_migration,
self.context, 'dest-host', self.instance, None,
self.migration, migrate_data)
- self.assertIn('Timed out waiting for events', six.text_type(ex))
+ self.assertIn('Timed out waiting for events', str(ex))
self.assertEqual('error', self.migration.status)
mock_rollback_live_mig.assert_called_once_with(
self.context, self.instance, 'dest-host',
@@ -10830,7 +10828,7 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase,
wrapped_exc = ex2.exc_info[1]
# The original error should be in the MigrationPreCheckError which
# itself is in the ExpectedException.
- self.assertIn(ex1.format_message(), six.text_type(wrapped_exc))
+ self.assertIn(ex1.format_message(), str(wrapped_exc))
# Assert the mock calls.
_send_prep_resize_notifications.assert_has_calls([
mock.call(self.context, self.instance,
@@ -10877,7 +10875,7 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase,
wrapped_exc = ex2.exc_info[1]
# The original error should be in the MigrationPreCheckError which
# itself is in the ExpectedException.
- self.assertIn(ex1.format_message(), six.text_type(wrapped_exc))
+ self.assertIn(ex1.format_message(), str(wrapped_exc))
# Assert the mock calls.
_send_prep_resize_notifications.assert_has_calls([
mock.call(self.context, self.instance,
@@ -11076,7 +11074,7 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase,
# ExpectedException.
wrapped_exc = ex2.exc_info[1]
self.assertIn('Failed to power off instance: testing',
- six.text_type(wrapped_exc))
+ str(wrapped_exc))
# Assert the non-decorator mock calls.
_prep_snapshot_based_resize_at_source.assert_called_once_with(
self.context, self.instance, self.migration,
@@ -11948,7 +11946,7 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase,
# is still called and in this case also fails so the resulting
# exception should be the one from _complete_volume_attachments
# but the finish_revert_migration error should have been logged.
- self.assertIn('vol complete failed', six.text_type(ex))
+ self.assertIn('vol complete failed', str(ex))
self.assertIn('driver fail', self.stdlog.logger.output)
# Assert the migration status was not updated.
self.migration.save.assert_not_called()
diff --git a/nova/tests/unit/compute/test_compute_utils.py b/nova/tests/unit/compute/test_compute_utils.py
index 5207002ab1..98d567de56 100644
--- a/nova/tests/unit/compute/test_compute_utils.py
+++ b/nova/tests/unit/compute/test_compute_utils.py
@@ -24,7 +24,6 @@ import mock
from oslo_serialization import jsonutils
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import uuidutils
-import six
from nova.accelerator.cyborg import _CyborgClient as cyborgclient
from nova.compute import manager
@@ -178,7 +177,7 @@ class ComputeValidateDeviceTestCase(test.NoDBTestCase):
def test_device_in_use(self):
exc = self.assertRaises(exception.DevicePathInUse,
self._validate_device, '/dev/vda')
- self.assertIn('/dev/vda', six.text_type(exc))
+ self.assertIn('/dev/vda', str(exc))
def test_swap(self):
self.instance['default_swap_device'] = "/dev/vdc"
diff --git a/nova/tests/unit/compute/test_instance_list.py b/nova/tests/unit/compute/test_instance_list.py
index 2da6121b51..4ee1190479 100644
--- a/nova/tests/unit/compute/test_instance_list.py
+++ b/nova/tests/unit/compute/test_instance_list.py
@@ -12,7 +12,6 @@
import mock
from oslo_utils.fixture import uuidsentinel as uuids
-import six
from nova.compute import instance_list
from nova.compute import multi_cell_list
@@ -215,7 +214,7 @@ class TestInstanceList(test.NoDBTestCase):
exp = self.assertRaises(exception.NovaException,
instance_list.get_instance_objects_sorted, self.context, {}, None,
None, [], None, None)
- self.assertIn('configuration indicates', six.text_type(exp))
+ self.assertIn('configuration indicates', str(exp))
@mock.patch('nova.context.scatter_gather_cells')
def test_get_instances_with_cell_down_support(self, mock_sg):
diff --git a/nova/tests/unit/compute/test_keypairs.py b/nova/tests/unit/compute/test_keypairs.py
index 0a5b544c7a..339ffe4783 100644
--- a/nova/tests/unit/compute/test_keypairs.py
+++ b/nova/tests/unit/compute/test_keypairs.py
@@ -17,7 +17,6 @@
import mock
from oslo_concurrency import processutils
from oslo_config import cfg
-import six
from nova.compute import api as compute_api
from nova import context
@@ -119,7 +118,7 @@ class CreateImportSharedTestMixIn(object):
exc = self.assertRaises(exc_class, func, self.ctxt, self.ctxt.user_id,
name, *args)
- self.assertEqual(expected_message, six.text_type(exc))
+ self.assertEqual(expected_message, str(exc))
def assertInvalidKeypair(self, expected_message, name):
msg = 'Keypair data is invalid: %s' % expected_message
@@ -232,7 +231,7 @@ class ImportKeypairTestCase(KeypairAPITestCase, CreateImportSharedTestMixIn):
self.ctxt, self.ctxt.user_id, 'foo',
'bad key data')
msg = u'Keypair data is invalid: failed to generate fingerprint'
- self.assertEqual(msg, six.text_type(exc))
+ self.assertEqual(msg, str(exc))
class GetKeypairTestCase(KeypairAPITestCase):
diff --git a/nova/tests/unit/compute/test_rpcapi.py b/nova/tests/unit/compute/test_rpcapi.py
index 6beee6a5be..f2655eddfc 100644
--- a/nova/tests/unit/compute/test_rpcapi.py
+++ b/nova/tests/unit/compute/test_rpcapi.py
@@ -19,7 +19,6 @@ Unit Tests for nova.compute.rpcapi
import mock
from oslo_serialization import jsonutils
from oslo_utils.fixture import uuidsentinel as uuids
-import six
from nova.compute import rpcapi as compute_rpcapi
from nova import context
@@ -534,7 +533,7 @@ class ComputeRpcAPITestCase(test.NoDBTestCase):
limits={},
request_spec=objects.RequestSpec(),
destination='dest')
- self.assertIn('Compute too old', six.text_type(ex))
+ self.assertIn('Compute too old', str(ex))
def test_prep_snapshot_based_resize_at_source(self):
"""Tests happy path for prep_snapshot_based_resize_at_source rpc call
@@ -564,7 +563,7 @@ class ComputeRpcAPITestCase(test.NoDBTestCase):
instance=self.fake_instance_obj,
migration=migration_obj.Migration(),
snapshot_id=uuids.snapshot_id)
- self.assertIn('Compute too old', six.text_type(ex))
+ self.assertIn('Compute too old', str(ex))
def test_finish_snapshot_based_resize_at_dest(self):
"""Tests happy path for finish_snapshot_based_resize_at_dest."""
@@ -595,7 +594,7 @@ class ComputeRpcAPITestCase(test.NoDBTestCase):
migration=migration_obj.Migration(dest_compute='dest'),
snapshot_id=uuids.snapshot_id,
request_spec=objects.RequestSpec())
- self.assertIn('Compute too old', six.text_type(ex))
+ self.assertIn('Compute too old', str(ex))
def test_confirm_snapshot_based_resize_at_source(self):
"""Tests happy path for confirm_snapshot_based_resize_at_source."""
@@ -622,7 +621,7 @@ class ComputeRpcAPITestCase(test.NoDBTestCase):
self.context,
instance=self.fake_instance_obj,
migration=migration_obj.Migration(source_compute='source'))
- self.assertIn('Compute too old', six.text_type(ex))
+ self.assertIn('Compute too old', str(ex))
def test_revert_snapshot_based_resize_at_dest(self):
"""Tests happy path for revert_snapshot_based_resize_at_dest."""
@@ -649,7 +648,7 @@ class ComputeRpcAPITestCase(test.NoDBTestCase):
self.context,
instance=self.fake_instance_obj,
migration=migration_obj.Migration(dest_compute='dest'))
- self.assertIn('Compute too old', six.text_type(ex))
+ self.assertIn('Compute too old', str(ex))
def test_finish_revert_snapshot_based_resize_at_source(self):
"""Tests happy path for finish_revert_snapshot_based_resize_at_source.
@@ -679,7 +678,7 @@ class ComputeRpcAPITestCase(test.NoDBTestCase):
self.context,
instance=self.fake_instance_obj,
migration=migration_obj.Migration(source_compute='source'))
- self.assertIn('Compute too old', six.text_type(ex))
+ self.assertIn('Compute too old', str(ex))
def test_reboot_instance(self):
self.maxDiff = None
diff --git a/nova/tests/unit/conductor/tasks/test_cross_cell_migrate.py b/nova/tests/unit/conductor/tasks/test_cross_cell_migrate.py
index 08c225a29c..938bbf1c15 100644
--- a/nova/tests/unit/conductor/tasks/test_cross_cell_migrate.py
+++ b/nova/tests/unit/conductor/tasks/test_cross_cell_migrate.py
@@ -16,7 +16,6 @@ import mock
from oslo_messaging import exceptions as messaging_exceptions
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import timeutils
-import six
from nova.compute import instance_actions
from nova.compute import power_state
@@ -452,8 +451,7 @@ class CrossCellMigrationTaskTestCase(test.NoDBTestCase):
return_value=False):
ex = self.assertRaises(exception.MigrationPreCheckError,
self.task._perform_external_api_checks)
- self.assertIn('Required networking service API extension',
- six.text_type(ex))
+ self.assertIn('Required networking service API extension', str(ex))
@mock.patch('nova.conductor.tasks.cross_cell_migrate.LOG.exception')
def test_rollback_idempotent(self, mock_log_exception):
@@ -472,7 +470,7 @@ class CrossCellMigrationTaskTestCase(test.NoDBTestCase):
with mock.patch.object(self.task, '_execute', side_effect=error):
# The TestingException from the main task should be raised.
ex = self.assertRaises(test.TestingException, self.task.execute)
- self.assertEqual('main task', six.text_type(ex))
+ self.assertEqual('main task', str(ex))
# And all three sub-task rollbacks should have been called.
for subtask in self.task._completed_tasks.values():
subtask.rollback.assert_called_once_with(error)
@@ -740,7 +738,7 @@ class PrepResizeAtDestTaskTestCase(test.NoDBTestCase):
exception.MigrationPreCheckError, self.task.execute)
self.assertIn(
'RPC timeout while checking if we can cross-cell migrate to '
- 'host: fake-host', six.text_type(ex))
+ 'host: fake-host', str(ex))
_create_port_bindings.assert_called_once_with()
_create_volume_attachments.assert_called_once_with()
@@ -1600,7 +1598,7 @@ class RevertResizeTaskTestCase(test.NoDBTestCase, ObjectComparatorMixin):
ex = self.assertRaises(exception.ObjectActionError,
self.task._update_source_obj_from_target_cell,
source, target)
- self.assertIn('nested objects are not supported', six.text_type(ex))
+ self.assertIn('nested objects are not supported', str(ex))
@mock.patch('nova.objects.Migration.get_by_uuid')
def test_update_migration_in_source_cell(self, mock_get_migration):
diff --git a/nova/tests/unit/conductor/tasks/test_live_migrate.py b/nova/tests/unit/conductor/tasks/test_live_migrate.py
index 65841cdad1..e8bb2310c9 100644
--- a/nova/tests/unit/conductor/tasks/test_live_migrate.py
+++ b/nova/tests/unit/conductor/tasks/test_live_migrate.py
@@ -14,7 +14,6 @@ import mock
import oslo_messaging as messaging
from oslo_serialization import jsonutils
from oslo_utils.fixture import uuidsentinel as uuids
-import six
from nova.compute import power_state
from nova.compute import rpcapi as compute_rpcapi
@@ -393,7 +392,7 @@ class LiveMigrationTaskTestCase(test.NoDBTestCase):
mock.patch.object(self.task, '_check_can_migrate_pci')):
ex = self.assertRaises(exception.MigrationPreCheckError,
self.task._check_requested_destination)
- self.assertIn('across cells', six.text_type(ex))
+ self.assertIn('across cells', str(ex))
@mock.patch.object(live_migrate.LiveMigrationTask,
'_call_livem_checks_on_host')
diff --git a/nova/tests/unit/conductor/test_conductor.py b/nova/tests/unit/conductor/test_conductor.py
index 12158cb343..9dd46a4932 100644
--- a/nova/tests/unit/conductor/test_conductor.py
+++ b/nova/tests/unit/conductor/test_conductor.py
@@ -24,7 +24,6 @@ from oslo_serialization import jsonutils
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import timeutils
from oslo_versionedobjects import exception as ovo_exc
-import six
from nova.accelerator import cyborg
from nova import block_device
@@ -2971,7 +2970,7 @@ class ConductorTaskTestCase(_BaseTaskTestCase, test_compute.BaseTestCase):
task_state=None,
expected_task_state=task_states.MIGRATING,),
expected_ex, request_spec)
- self.assertEqual(ex.kwargs['reason'], six.text_type(expected_ex))
+ self.assertEqual(ex.kwargs['reason'], str(expected_ex))
@mock.patch.object(scheduler_utils, 'set_vm_state_and_notify')
def test_set_vm_state_and_notify(self, mock_set):
diff --git a/nova/tests/unit/console/securityproxy/test_rfb.py b/nova/tests/unit/console/securityproxy/test_rfb.py
index 24a54608bb..d27b91c110 100644
--- a/nova/tests/unit/console/securityproxy/test_rfb.py
+++ b/nova/tests/unit/console/securityproxy/test_rfb.py
@@ -15,8 +15,6 @@
"""Tests the Console Security Proxy Framework."""
-import six
-
import mock
from nova.console.rfb import auth
@@ -128,7 +126,7 @@ class RFBSecurityProxyTestCase(test.NoDBTestCase):
self.proxy.connect,
self.tenant_sock,
self.compute_sock)
- self.assertIn('version 3.8, but server', six.text_type(ex))
+ self.assertIn('version 3.8, but server', str(ex))
self._assert_expected_calls()
def test_fails_on_tenant_version(self):
@@ -150,7 +148,7 @@ class RFBSecurityProxyTestCase(test.NoDBTestCase):
self.proxy.connect,
self.tenant_sock,
self.compute_sock)
- self.assertIn('version 3.8, but tenant', six.text_type(ex))
+ self.assertIn('version 3.8, but tenant', str(ex))
self._assert_expected_calls()
def test_fails_on_sec_type_cnt_zero(self):
@@ -172,7 +170,7 @@ class RFBSecurityProxyTestCase(test.NoDBTestCase):
self.proxy.connect,
self.tenant_sock,
self.compute_sock)
- self.assertIn('cheese', six.text_type(ex))
+ self.assertIn('cheese', str(ex))
self._assert_expected_calls()
diff --git a/nova/tests/unit/db/test_db_api.py b/nova/tests/unit/db/test_db_api.py
index dd2a369aae..9207a984db 100644
--- a/nova/tests/unit/db/test_db_api.py
+++ b/nova/tests/unit/db/test_db_api.py
@@ -36,7 +36,6 @@ from oslo_utils import fixture as utils_fixture
from oslo_utils.fixture import uuidsentinel
from oslo_utils import timeutils
from oslo_utils import uuidutils
-import six
from sqlalchemy import Column
from sqlalchemy.dialects import sqlite
from sqlalchemy.exc import OperationalError
@@ -828,7 +827,7 @@ class SqlAlchemyDbApiTestCase(DbTestCase):
self.assertEqual(1, len(result))
self.assertEqual(2, len(result['host1']))
- self.assertEqual(six.text_type, type(result['host1'][0]))
+ self.assertEqual(str, type(result['host1'][0]))
result = test2(ctxt)
diff --git a/nova/tests/unit/db/test_sqlalchemy_migration.py b/nova/tests/unit/db/test_sqlalchemy_migration.py
index 3fba944656..e5d7b7b8fd 100644
--- a/nova/tests/unit/db/test_sqlalchemy_migration.py
+++ b/nova/tests/unit/db/test_sqlalchemy_migration.py
@@ -20,7 +20,6 @@ from migrate.versioning import api as versioning_api
import mock
from oslo_db.sqlalchemy import utils as db_utils
from oslo_utils.fixture import uuidsentinel
-import six
import sqlalchemy
from nova import context
@@ -537,4 +536,4 @@ class TestServicesUUIDCheck(test.TestCase):
ex = self.assertRaises(exception.ValidationError,
self.migration.upgrade, self.engine)
self.assertIn('There are still 1 unmigrated records in the '
- 'services table.', six.text_type(ex))
+ 'services table.', str(ex))
diff --git a/nova/tests/unit/matchers.py b/nova/tests/unit/matchers.py
index f95abb1206..986583bd8f 100644
--- a/nova/tests/unit/matchers.py
+++ b/nova/tests/unit/matchers.py
@@ -21,7 +21,6 @@ import io
import pprint
from lxml import etree
-import six
from testtools import content
import testtools.matchers
@@ -409,7 +408,7 @@ class XMLMatches(object):
@staticmethod
def _parse(text_or_bytes):
- if isinstance(text_or_bytes, six.text_type):
+ if isinstance(text_or_bytes, str):
text_or_bytes = text_or_bytes.encode("utf-8")
parser = etree.XMLParser(encoding="UTF-8")
return etree.parse(io.BytesIO(text_or_bytes), parser)
@@ -567,7 +566,7 @@ class EncodedByUTF8(object):
except UnicodeDecodeError:
return testtools.matchers.Mismatch(
"%s is not encoded in UTF-8." % obj)
- elif isinstance(obj, six.text_type):
+ elif isinstance(obj, str):
try:
obj.encode("utf-8", "strict")
except UnicodeDecodeError:
diff --git a/nova/tests/unit/network/test_neutron.py b/nova/tests/unit/network/test_neutron.py
index 373e520154..a308c69e5c 100644
--- a/nova/tests/unit/network/test_neutron.py
+++ b/nova/tests/unit/network/test_neutron.py
@@ -31,7 +31,6 @@ from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import timeutils
from oslo_utils import uuidutils
import requests_mock
-import six
from nova import context
from nova.db.sqlalchemy import api as db_api
@@ -176,7 +175,7 @@ class TestNeutronClient(test.NoDBTestCase):
exc = self.assertRaises(
exception.Forbidden,
client.create_port)
- self.assertIsInstance(exc.format_message(), six.text_type)
+ self.assertIsInstance(exc.format_message(), str)
def test_withtoken_context_is_admin(self):
self.flags(endpoint_override='http://anyhost/', group='neutron')
@@ -438,8 +437,8 @@ class TestAPIBase(test.TestCase):
info_cache['created_at'] = timeutils.utcnow()
info_cache['deleted_at'] = timeutils.utcnow()
info_cache['updated_at'] = timeutils.utcnow()
- info_cache['network_info'] = model.NetworkInfo.hydrate(six.text_type(
- jsonutils.dumps(nw_info)))
+ info_cache['network_info'] = model.NetworkInfo.hydrate(
+ str(jsonutils.dumps(nw_info)))
return info_cache
def _fake_instance_object_with_info_cache(self, instance):
@@ -1828,7 +1827,7 @@ class TestAPI(TestAPIBase):
self.api.validate_networks, self.context,
requested_networks, 1)
- self.assertIn(uuids.my_netid1, six.text_type(ex))
+ self.assertIn(uuids.my_netid1, str(ex))
mock_get_client.assert_called_once_with(self.context)
mocked_client.list_networks.assert_called_once_with(
id=[uuids.my_netid1])
@@ -1847,8 +1846,8 @@ class TestAPI(TestAPIBase):
self.api.validate_networks,
self.context, requested_networks, 1)
- self.assertIn(uuids.my_netid2, six.text_type(ex))
- self.assertIn(uuids.my_netid3, six.text_type(ex))
+ self.assertIn(uuids.my_netid2, str(ex))
+ self.assertIn(uuids.my_netid3, str(ex))
mock_get_client.assert_called_once_with(self.context)
mocked_client.list_networks.assert_called_once_with(id=ids)
@@ -4074,7 +4073,7 @@ class TestAPI(TestAPIBase):
'(Network ID is %(net_id)s)' %
{'instance': instance.uuid,
'net_id': uuids.my_netid1})
- self.assertEqual(expected_exception_msg, six.text_type(exc))
+ self.assertEqual(expected_exception_msg, str(exc))
mock_client.delete_port.assert_called_once_with(uuids.port_id)
@mock.patch('nova.network.neutron.LOG')
@@ -4098,7 +4097,7 @@ class TestAPI(TestAPIBase):
'(Network ID is %(net_id)s)' %
{'instance': instance.uuid,
'net_id': uuids.my_netid1})
- self.assertEqual(expected_exception_msg, six.text_type(exc))
+ self.assertEqual(expected_exception_msg, str(exc))
mock_client.delete_port.assert_called_once_with(uuids.port_id)
self.assertTrue(mock_log.exception.called)
@@ -4693,7 +4692,7 @@ class TestAPI(TestAPIBase):
self.assertIn(
"Provider mappings are not available to the compute service but "
"are required for ports with a resource request.",
- six.text_type(ex))
+ str(ex))
@mock.patch.object(neutronapi, 'get_client', return_value=mock.Mock())
def test_update_port_bindings_for_instance_with_resource_req_live_mig(
@@ -4929,8 +4928,8 @@ class TestAPI(TestAPIBase):
self.api.setup_networks_on_host,
self.context, instance, host='new-host', teardown=True)
# Make sure both ports show up in the exception message.
- self.assertIn(uuids.port1, six.text_type(ex))
- self.assertIn(uuids.port2, six.text_type(ex))
+ self.assertIn(uuids.port1, str(ex))
+ self.assertIn(uuids.port2, str(ex))
self.api._clear_migration_port_profile.assert_called_once_with(
self.context, instance, get_client_mock.return_value,
get_ports['ports'])
diff --git a/nova/tests/unit/network/test_os_vif_util.py b/nova/tests/unit/network/test_os_vif_util.py
index c96fca51bb..12971f2314 100644
--- a/nova/tests/unit/network/test_os_vif_util.py
+++ b/nova/tests/unit/network/test_os_vif_util.py
@@ -14,7 +14,6 @@
from os_vif import objects as osv_objects
from os_vif.objects import fields as os_vif_fields
-import six
from nova import exception
from nova.network import model
@@ -1016,7 +1015,7 @@ class OSVIFUtilTestCase(test.NoDBTestCase):
ex = self.assertRaises(exception.NovaException,
os_vif_util.nova_to_osvif_vif, vif)
- self.assertIn('Unsupported VIF type wibble', six.text_type(ex))
+ self.assertIn('Unsupported VIF type wibble', str(ex))
def test_nova_to_osvif_vif_binding_failed(self):
vif = model.VIF(
diff --git a/nova/tests/unit/objects/test_host_mapping.py b/nova/tests/unit/objects/test_host_mapping.py
index 7cbd9ae9c9..8917e318af 100644
--- a/nova/tests/unit/objects/test_host_mapping.py
+++ b/nova/tests/unit/objects/test_host_mapping.py
@@ -13,7 +13,6 @@
import mock
from oslo_db import exception as db_exc
from oslo_utils.fixture import uuidsentinel as uuids
-import six
from nova import context
from nova import exception
@@ -330,7 +329,7 @@ Found 1 unmapped computes in cell: %(cell)s""" % {'cell': uuids.cell1}
exp = self.assertRaises(exception.HostMappingExists,
host_mapping.discover_hosts, ctxt)
expected = "Host 'bar' mapping already exists"
- self.assertIn(expected, six.text_type(exp))
+ self.assertIn(expected, str(exp))
@mock.patch('nova.objects.CellMappingList.get_all')
@mock.patch('nova.objects.HostMapping.get_by_host')
@@ -349,4 +348,4 @@ Found 1 unmapped computes in cell: %(cell)s""" % {'cell': uuids.cell1}
host_mapping.discover_hosts, ctxt,
by_service=True)
expected = "Host 'bar' mapping already exists"
- self.assertIn(expected, six.text_type(exp))
+ self.assertIn(expected, str(exp))
diff --git a/nova/tests/unit/objects/test_image_meta.py b/nova/tests/unit/objects/test_image_meta.py
index 3cbb8e925d..445fe8b9c8 100644
--- a/nova/tests/unit/objects/test_image_meta.py
+++ b/nova/tests/unit/objects/test_image_meta.py
@@ -13,7 +13,6 @@
# under the License.
import datetime
-import six
from nova import exception
from nova import objects
@@ -373,7 +372,7 @@ class TestImageMetaProps(test.NoDBTestCase):
obj = objects.ImageMetaProps(hw_video_model=model)
ex = self.assertRaises(exception.ObjectActionError,
obj.obj_to_primitive, '1.21')
- self.assertIn('hw_video_model', six.text_type(ex))
+ self.assertIn('hw_video_model', str(ex))
def test_obj_make_compatible_watchdog_action_not_disabled(self):
"""Tests that we don't pop the hw_watchdog_action if the value is not
diff --git a/nova/tests/unit/objects/test_instance.py b/nova/tests/unit/objects/test_instance.py
index 63e82eab5a..53f3ea415f 100644
--- a/nova/tests/unit/objects/test_instance.py
+++ b/nova/tests/unit/objects/test_instance.py
@@ -14,7 +14,6 @@
import collections
import datetime
-import six
import mock
import netaddr
@@ -1210,7 +1209,7 @@ class _TestInstanceObject(object):
inst.host = None
ex = self.assertRaises(exception.ObjectActionError,
inst.destroy, hard_delete=True)
- self.assertIn('host changed', six.text_type(ex))
+ self.assertIn('host changed', str(ex))
def test_name_does_not_trigger_lazy_loads(self):
values = {'user_id': self.context.user_id,
diff --git a/nova/tests/unit/objects/test_instance_action.py b/nova/tests/unit/objects/test_instance_action.py
index 6576f60b99..aa9fc20025 100644
--- a/nova/tests/unit/objects/test_instance_action.py
+++ b/nova/tests/unit/objects/test_instance_action.py
@@ -19,7 +19,6 @@ import mock
from oslo_utils import fixture as utils_fixture
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import timeutils
-import six
from nova.db import api as db
from nova import exception
@@ -187,7 +186,7 @@ class _TestInstanceActionObject(object):
def test_create_id_in_updates_error(self):
action = instance_action.InstanceAction(self.context, id=1)
ex = self.assertRaises(exception.ObjectActionError, action.create)
- self.assertIn('already created', six.text_type(ex))
+ self.assertIn('already created', str(ex))
@mock.patch('nova.db.api.action_start')
def test_create(self, mock_action_start):
@@ -335,14 +334,13 @@ class _TestInstanceActionEventObject(object):
self.useFixture(utils_fixture.TimeFixture(NOW))
test_class = instance_action.InstanceActionEvent
expected_packed_values = test_class.pack_action_event_finish(
- self.context, 'fake-uuid', 'fake-event', 'val',
- six.text_type('fake-tb'))
+ self.context, 'fake-uuid', 'fake-event', 'val', 'fake-tb')
expected_packed_values['finish_time'] = NOW
mock_finish.return_value = fake_event
event = test_class.event_finish_with_failure(
self.context, 'fake-uuid', 'fake-event', exc_val='val',
- exc_tb=six.text_type('fake-tb'), want_result=True)
+ exc_tb='fake-tb', want_result=True)
mock_finish.assert_called_once_with(self.context,
expected_packed_values)
self.compare_obj(event, fake_event)
@@ -404,7 +402,7 @@ class _TestInstanceActionEventObject(object):
ex = self.assertRaises(
exception.ObjectActionError, event.create,
fake_action['instance_uuid'], fake_action['request_id'])
- self.assertIn('already created', six.text_type(ex))
+ self.assertIn('already created', str(ex))
@mock.patch('nova.db.api.action_event_start')
def test_create(self, mock_action_event_start):
diff --git a/nova/tests/unit/objects/test_objects.py b/nova/tests/unit/objects/test_objects.py
index e19f7c7bd0..a0fe7b9e98 100644
--- a/nova/tests/unit/objects/test_objects.py
+++ b/nova/tests/unit/objects/test_objects.py
@@ -25,7 +25,6 @@ from oslo_utils import timeutils
from oslo_versionedobjects import base as ovo_base
from oslo_versionedobjects import exception as ovo_exc
from oslo_versionedobjects import fixture
-import six
from nova import context
from nova import exception
@@ -257,7 +256,7 @@ class FakeIndirectionHack(fixture.FakeIndirectionAPI):
objinst = self._ser.deserialize_entity(
context, self._ser.serialize_entity(
context, objinst))
- objmethod = six.text_type(objmethod)
+ objmethod = str(objmethod)
args = self._ser.deserialize_entity(
None, self._ser.serialize_entity(None, args))
kwargs = self._ser.deserialize_entity(
@@ -272,9 +271,9 @@ class FakeIndirectionHack(fixture.FakeIndirectionAPI):
def object_class_action(self, context, objname, objmethod, objver,
args, kwargs):
- objname = six.text_type(objname)
- objmethod = six.text_type(objmethod)
- objver = six.text_type(objver)
+ objname = str(objname)
+ objmethod = str(objmethod)
+ objver = str(objver)
args = self._ser.deserialize_entity(
None, self._ser.serialize_entity(None, args))
kwargs = self._ser.deserialize_entity(
@@ -292,9 +291,9 @@ class FakeIndirectionHack(fixture.FakeIndirectionAPI):
def object_class_action_versions(self, context, objname, objmethod,
object_versions, args, kwargs):
- objname = six.text_type(objname)
- objmethod = six.text_type(objmethod)
- object_versions = {six.text_type(o): six.text_type(v)
+ objname = str(objname)
+ objmethod = str(objmethod)
+ object_versions = {str(o): str(v)
for o, v in object_versions.items()}
args, kwargs = self._canonicalize_args(context, args, kwargs)
objver = object_versions[objname]
diff --git a/nova/tests/unit/objects/test_resource.py b/nova/tests/unit/objects/test_resource.py
index 966d9c6d20..892562f11d 100644
--- a/nova/tests/unit/objects/test_resource.py
+++ b/nova/tests/unit/objects/test_resource.py
@@ -13,7 +13,6 @@
import mock
from oslo_serialization import jsonutils
from oslo_utils.fixture import uuidsentinel as uuids
-import six
from nova.objects import resource
from nova.tests.unit.objects import test_objects
@@ -53,8 +52,7 @@ class TestResourceObject(test_objects._LocalTest):
resource_class=rc,
identifier='foo')
except ValueError as e:
- self.assertEqual('Malformed Resource Class %s' % rc,
- six.text_type(e))
+ self.assertEqual('Malformed Resource Class %s' % rc, str(e))
else:
self.fail('Check malformed resource class failed.')
diff --git a/nova/tests/unit/objects/test_service.py b/nova/tests/unit/objects/test_service.py
index de4d96d53f..e5ad835ff9 100644
--- a/nova/tests/unit/objects/test_service.py
+++ b/nova/tests/unit/objects/test_service.py
@@ -17,7 +17,6 @@ from oslo_utils.fixture import uuidsentinel
from oslo_utils import timeutils
from oslo_versionedobjects import base as ovo_base
from oslo_versionedobjects import exception as ovo_exc
-import six
from nova.compute import manager as compute_manager
from nova import context
@@ -530,7 +529,7 @@ class TestServiceVersionCells(test.TestCase):
ex = self.assertRaises(exception.ObjectActionError,
service.get_minimum_version_all_cells,
self.context, ['compute'])
- self.assertIn('Invalid binary prefix', six.text_type(ex))
+ self.assertIn('Invalid binary prefix', str(ex))
self.assertTrue(mock_log.warning.called)
@mock.patch('nova.context.scatter_gather_all_cells')
diff --git a/nova/tests/unit/pci/test_devspec.py b/nova/tests/unit/pci/test_devspec.py
index ad895c79e6..69d774cd86 100644
--- a/nova/tests/unit/pci/test_devspec.py
+++ b/nova/tests/unit/pci/test_devspec.py
@@ -13,7 +13,6 @@
import mock
-import six
from nova import exception
from nova import objects
@@ -212,7 +211,7 @@ class PciAddressTestCase(test.NoDBTestCase):
devspec.PciDeviceSpec, pci_info)
msg = ("Invalid PCI devices Whitelist config: property func ('12:6') "
"does not parse as a hex number.")
- self.assertEqual(msg, six.text_type(exc))
+ self.assertEqual(msg, str(exc))
def test_max_func(self):
pci_info = {"address": "0000:0a:00.%s" % (devspec.MAX_FUNC + 1),
@@ -222,7 +221,7 @@ class PciAddressTestCase(test.NoDBTestCase):
msg = ('Invalid PCI devices Whitelist config: property func (%x) is '
'greater than the maximum allowable value (%x).'
% (devspec.MAX_FUNC + 1, devspec.MAX_FUNC))
- self.assertEqual(msg, six.text_type(exc))
+ self.assertEqual(msg, str(exc))
def test_max_domain(self):
pci_info = {"address": "%x:0a:00.5" % (devspec.MAX_DOMAIN + 1),
@@ -232,7 +231,7 @@ class PciAddressTestCase(test.NoDBTestCase):
msg = ('Invalid PCI devices Whitelist config: property domain (%X) '
'is greater than the maximum allowable value (%X).'
% (devspec.MAX_DOMAIN + 1, devspec.MAX_DOMAIN))
- self.assertEqual(msg, six.text_type(exc))
+ self.assertEqual(msg, str(exc))
def test_max_bus(self):
pci_info = {"address": "0000:%x:00.5" % (devspec.MAX_BUS + 1),
@@ -242,7 +241,7 @@ class PciAddressTestCase(test.NoDBTestCase):
msg = ('Invalid PCI devices Whitelist config: property bus (%X) is '
'greater than the maximum allowable value (%X).'
% (devspec.MAX_BUS + 1, devspec.MAX_BUS))
- self.assertEqual(msg, six.text_type(exc))
+ self.assertEqual(msg, str(exc))
def test_max_slot(self):
pci_info = {"address": "0000:0a:%x.5" % (devspec.MAX_SLOT + 1),
@@ -252,7 +251,7 @@ class PciAddressTestCase(test.NoDBTestCase):
msg = ('Invalid PCI devices Whitelist config: property slot (%X) is '
'greater than the maximum allowable value (%X).'
% (devspec.MAX_SLOT + 1, devspec.MAX_SLOT))
- self.assertEqual(msg, six.text_type(exc))
+ self.assertEqual(msg, str(exc))
def test_address_is_undefined(self):
pci_info = {"vendor_id": "8086", "product_id": "5057"}
@@ -388,7 +387,7 @@ class PciDevSpecTestCase(test.NoDBTestCase):
self.assertEqual(
"Invalid PCI devices Whitelist config: property vendor_id (80860) "
"is greater than the maximum allowable value (FFFF).",
- six.text_type(exc))
+ str(exc))
def test_invalid_product_id(self):
pci_info = {"vendor_id": "8086", "address": "*: *: *.5",
@@ -404,7 +403,7 @@ class PciDevSpecTestCase(test.NoDBTestCase):
self.assertEqual(
"Invalid PCI devices Whitelist config: property product_id "
"(50570) is greater than the maximum allowable value (FFFF).",
- six.text_type(exc))
+ str(exc))
def test_devname_and_address(self):
pci_info = {"devname": "eth0", "vendor_id": "8086",
diff --git a/nova/tests/unit/scheduler/client/test_report.py b/nova/tests/unit/scheduler/client/test_report.py
index 7e9db2cd39..8c1ac409ff 100644
--- a/nova/tests/unit/scheduler/client/test_report.py
+++ b/nova/tests/unit/scheduler/client/test_report.py
@@ -19,7 +19,6 @@ import mock
import os_resource_classes as orc
from oslo_serialization import jsonutils
from oslo_utils.fixture import uuidsentinel as uuids
-import six
import nova.conf
from nova import context
@@ -3588,7 +3587,7 @@ class TestAllocations(SchedulerReportClientTestCase):
exception.AllocationUpdateFailed,
self._test_remove_res_from_alloc, current_allocations,
resources_to_remove, None)
- self.assertIn('The allocation is empty', six.text_type(ex))
+ self.assertIn('The allocation is empty', str(ex))
@mock.patch("nova.scheduler.client.report.SchedulerReportClient.put")
@mock.patch("nova.scheduler.client.report.SchedulerReportClient.get")
@@ -3623,9 +3622,7 @@ class TestAllocations(SchedulerReportClientTestCase):
ex = self.assertRaises(
exception.AllocationUpdateFailed, self._test_remove_res_from_alloc,
current_allocations, resources_to_remove, None)
- self.assertIn(
- "Key 'VCPU' is missing from the allocation",
- six.text_type(ex))
+ self.assertIn("Key 'VCPU' is missing from the allocation", str(ex))
def test_remove_res_from_alloc_missing_rp(self):
current_allocations = {
@@ -3652,7 +3649,7 @@ class TestAllocations(SchedulerReportClientTestCase):
current_allocations, resources_to_remove, None)
self.assertIn(
"Key '%s' is missing from the allocation" % uuids.other_rp,
- six.text_type(ex))
+ str(ex))
def test_remove_res_from_alloc_not_enough_resource_to_remove(self):
current_allocations = {
@@ -3682,7 +3679,7 @@ class TestAllocations(SchedulerReportClientTestCase):
'provider to remove 400 amount of NET_BW_EGR_KILOBIT_PER_SEC '
'resources' %
uuids.rp1,
- six.text_type(ex))
+ str(ex))
@mock.patch('time.sleep', new=mock.Mock())
@mock.patch("nova.scheduler.client.report.SchedulerReportClient.put")
@@ -3810,7 +3807,7 @@ class TestAllocations(SchedulerReportClientTestCase):
self.context, uuids.consumer_uuid, resources_to_remove)
self.assertIn(
'due to multiple successive generation conflicts',
- six.text_type(ex))
+ str(ex))
get_call = mock.call(
'/allocations/%s' % uuids.consumer_uuid, version='1.28',
diff --git a/nova/tests/unit/scheduler/filters/test_compute_capabilities_filters.py b/nova/tests/unit/scheduler/filters/test_compute_capabilities_filters.py
index 09c5e701f8..a90ec4367d 100644
--- a/nova/tests/unit/scheduler/filters/test_compute_capabilities_filters.py
+++ b/nova/tests/unit/scheduler/filters/test_compute_capabilities_filters.py
@@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
-
from nova import objects
from nova.scheduler.filters import compute_capabilities_filter
from nova import test
@@ -53,7 +51,7 @@ class TestComputeCapabilitiesFilter(test.NoDBTestCase):
def test_compute_filter_fails_without_capabilites(self):
cpu_info = """ { } """
- cpu_info = six.text_type(cpu_info)
+ cpu_info = str(cpu_info)
self._do_test_compute_filter_extra_specs(
ecaps={'cpu_info': cpu_info},
@@ -65,7 +63,7 @@ class TestComputeCapabilitiesFilter(test.NoDBTestCase):
"arch": "i686","features": ["lahf_lm", "rdtscp"], "topology":
{"cores": 1, "threads":1, "sockets": 1}} """
- cpu_info = six.text_type(cpu_info)
+ cpu_info = str(cpu_info)
self._do_test_compute_filter_extra_specs(
ecaps={'cpu_info': cpu_info},
@@ -77,7 +75,7 @@ class TestComputeCapabilitiesFilter(test.NoDBTestCase):
"arch": "i686","features": ["lahf_lm", "rdtscp"], "topology":
{"cores": 1, "threads":1, "sockets": 1}} """
- cpu_info = six.text_type(cpu_info)
+ cpu_info = str(cpu_info)
self._do_test_compute_filter_extra_specs(
ecaps={'cpu_info': cpu_info},
@@ -89,7 +87,7 @@ class TestComputeCapabilitiesFilter(test.NoDBTestCase):
"arch": "i686","features": ["lahf_lm", "rdtscp"], "topology":
{"cores": 1, "threads":1, "sockets": 1}} """
- cpu_info = six.text_type(cpu_info)
+ cpu_info = str(cpu_info)
self._do_test_compute_filter_extra_specs(
ecaps={'cpu_info': cpu_info},
@@ -98,7 +96,7 @@ class TestComputeCapabilitiesFilter(test.NoDBTestCase):
def test_compute_filter_fail_cpu_info_as_text_type_not_valid(self):
cpu_info = "cpu_info"
- cpu_info = six.text_type(cpu_info)
+ cpu_info = str(cpu_info)
self._do_test_compute_filter_extra_specs(
ecaps={'cpu_info': cpu_info},
especs={'capabilities:cpu_info:vendor': 'Intel'},
diff --git a/nova/tests/unit/scheduler/test_scheduler_utils.py b/nova/tests/unit/scheduler/test_scheduler_utils.py
index d63529c295..356e2c6e1f 100644
--- a/nova/tests/unit/scheduler/test_scheduler_utils.py
+++ b/nova/tests/unit/scheduler/test_scheduler_utils.py
@@ -18,7 +18,6 @@ Tests For Scheduler Utils
import mock
from oslo_utils.fixture import uuidsentinel as uuids
-import six
from nova.compute import flavors
from nova.compute import utils as compute_utils
@@ -245,7 +244,7 @@ class SchedulerUtilsTestCase(test.NoDBTestCase):
scheduler_utils.populate_retry,
filter_properties, uuids.instance)
# make sure 'msg' is a substring of the complete exception text
- self.assertIn(msg, six.text_type(nvh))
+ self.assertIn(msg, str(nvh))
def _check_parse_options(self, opts, sep, converter, expected):
good = scheduler_utils.parse_options(opts,
diff --git a/nova/tests/unit/scheduler/test_utils.py b/nova/tests/unit/scheduler/test_utils.py
index e5a5e73a0f..2a5aeb6e08 100644
--- a/nova/tests/unit/scheduler/test_utils.py
+++ b/nova/tests/unit/scheduler/test_utils.py
@@ -15,7 +15,6 @@ import mock
import os_resource_classes as orc
from oslo_serialization import jsonutils
from oslo_utils.fixture import uuidsentinel as uuids
-import six
from nova import context as nova_context
from nova import exception
@@ -1310,7 +1309,7 @@ class TestUtils(TestUtilsBase):
self.context, instance.uuid)
self.assertIn(
'Expected to find allocations for source node resource '
- 'provider %s' % source_node.uuid, six.text_type(ex))
+ 'provider %s' % source_node.uuid, str(ex))
test()
diff --git a/nova/tests/unit/test_api_validation.py b/nova/tests/unit/test_api_validation.py
index a5d1e00648..d7499ce946 100644
--- a/nova/tests/unit/test_api_validation.py
+++ b/nova/tests/unit/test_api_validation.py
@@ -17,7 +17,6 @@ import re
import fixtures
from jsonschema import exceptions as jsonschema_exc
-import six
from nova.api.openstack import api_version_request as api_version
from nova.api import validation
@@ -284,7 +283,7 @@ class QueryParamsSchemaTestCase(test.NoDBTestCase):
req.api_version_request = api_version.APIVersionRequest("2.1")
ex = self.assertRaises(
exception.ValidationError, self.controller.get, req)
- self.assertIn("Query string is not UTF-8 encoded", six.text_type(ex))
+ self.assertIn("Query string is not UTF-8 encoded", str(ex))
def test_strip_out_additional_properties(self):
req = fakes.HTTPRequest.blank(
diff --git a/nova/tests/unit/test_availability_zones.py b/nova/tests/unit/test_availability_zones.py
index 6252ef10ac..36f94ab422 100644
--- a/nova/tests/unit/test_availability_zones.py
+++ b/nova/tests/unit/test_availability_zones.py
@@ -19,7 +19,6 @@ Tests for availability zones
import mock
from oslo_utils.fixture import uuidsentinel
-import six
from nova import availability_zones as az
from nova.compute import api as compute_api
@@ -120,7 +119,7 @@ class AvailabilityZoneTestCases(test.TestCase):
service = self._create_service_with_topic('network', self.host)
services = db.service_get_all(self.context)
az.set_availability_zones(self.context, services)
- self.assertIsInstance(services[0]['host'], six.text_type)
+ self.assertIsInstance(services[0]['host'], str)
cached_key = az._make_cache_key(services[0]['host'])
self.assertIsInstance(cached_key, str)
self._destroy_service(service)
diff --git a/nova/tests/unit/test_block_device.py b/nova/tests/unit/test_block_device.py
index 74a8c4e764..2e9d768d58 100644
--- a/nova/tests/unit/test_block_device.py
+++ b/nova/tests/unit/test_block_device.py
@@ -20,7 +20,6 @@ Tests for Block Device utility functions.
import mock
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import units
-import six
from nova import block_device
from nova.compute import api as compute_api
@@ -630,8 +629,7 @@ class TestBlockDeviceDict(test.NoDBTestCase):
ex = self.assertRaises(exception.InvalidBDMFormat,
block_device.BlockDeviceDict.from_api,
api_dict, False)
- self.assertIn('Mapping image to local is not supported',
- six.text_type(ex))
+ self.assertIn('Mapping image to local is not supported', str(ex))
def test_from_api_invalid_volume_type_to_destination_local_mapping(self):
api_dict = {'id': 1,
@@ -643,7 +641,7 @@ class TestBlockDeviceDict(test.NoDBTestCase):
block_device.BlockDeviceDict.from_api,
api_dict, False)
self.assertIn('Specifying a volume_type with destination_type=local '
- 'is not supported', six.text_type(ex))
+ 'is not supported', str(ex))
def test_from_api_invalid_specify_volume_type_with_source_volume_mapping(
self):
@@ -656,7 +654,7 @@ class TestBlockDeviceDict(test.NoDBTestCase):
block_device.BlockDeviceDict.from_api,
api_dict, False)
self.assertIn('Specifying volume type to existing volume is '
- 'not supported', six.text_type(ex))
+ 'not supported', str(ex))
def test_legacy(self):
for legacy, new in zip(self.legacy_mapping, self.new_mapping):
diff --git a/nova/tests/unit/test_exception.py b/nova/tests/unit/test_exception.py
index 0db2ee906d..099ab9ba2e 100644
--- a/nova/tests/unit/test_exception.py
+++ b/nova/tests/unit/test_exception.py
@@ -18,7 +18,6 @@ import inspect
import fixtures
import mock
-import six
from webob.util import status_reasons
from nova import context
@@ -148,11 +147,10 @@ class NovaExceptionTestCase(test.NoDBTestCase):
msg_fmt = "default message"
exc = FakeNovaException()
- self.assertEqual('default message', six.text_type(exc))
+ self.assertEqual('default message', str(exc))
def test_error_msg(self):
- self.assertEqual('test',
- six.text_type(exception.NovaException('test')))
+ self.assertEqual('test', str(exception.NovaException('test')))
self.assertEqual('test',
exception.NovaException(Exception('test')).message)
@@ -161,7 +159,7 @@ class NovaExceptionTestCase(test.NoDBTestCase):
msg_fmt = "default message: %(code)s"
exc = FakeNovaException(code=500)
- self.assertEqual('default message: 500', six.text_type(exc))
+ self.assertEqual('default message: 500', str(exc))
self.assertEqual('default message: 500', exc.message)
def test_error_msg_exception_with_kwargs(self):
@@ -169,7 +167,7 @@ class NovaExceptionTestCase(test.NoDBTestCase):
msg_fmt = "default message: %(misspelled_code)s"
exc = FakeNovaException(code=500, misspelled_code='blah')
- self.assertEqual('default message: blah', six.text_type(exc))
+ self.assertEqual('default message: blah', str(exc))
self.assertEqual('default message: blah', exc.message)
def test_default_error_code(self):
@@ -198,7 +196,7 @@ class NovaExceptionTestCase(test.NoDBTestCase):
msg_fmt = "some message"
exc = FakeNovaException()
- self.assertEqual(six.text_type(exc), exc.format_message())
+ self.assertEqual(str(exc), exc.format_message())
def test_format_message_remote(self):
class FakeNovaException_Remote(exception.NovaException):
@@ -208,7 +206,7 @@ class NovaExceptionTestCase(test.NoDBTestCase):
return "print the whole trace"
exc = FakeNovaException_Remote()
- self.assertEqual(u"print the whole trace", six.text_type(exc))
+ self.assertEqual(u"print the whole trace", str(exc))
self.assertEqual("some message", exc.format_message())
def test_format_message_remote_error(self):
diff --git a/nova/tests/unit/test_metadata.py b/nova/tests/unit/test_metadata.py
index 45c2b6a6a8..b74a0a533e 100644
--- a/nova/tests/unit/test_metadata.py
+++ b/nova/tests/unit/test_metadata.py
@@ -36,7 +36,6 @@ from oslo_serialization import jsonutils
from oslo_utils import encodeutils
from oslo_utils.fixture import uuidsentinel as uuids
import requests
-import six
import webob
from nova.api.metadata import base
@@ -933,7 +932,7 @@ class OpenStackMetadataTestCase(test.TestCase):
# Verify the warning message is the one we expect which is the
# first and only arg to the first and only call to the warning.
self.assertIn('Passing insecure dynamic vendordata requests',
- six.text_type(warning_calls[0][0]))
+ str(warning_calls[0][0]))
self.assertEqual('10.0.0.1', vd['static'].get('ldap'))
self.assertEqual('10.0.0.2', vd['static'].get('ad'))
diff --git a/nova/tests/unit/test_rpc.py b/nova/tests/unit/test_rpc.py
index 59503316b3..1c55fabe2b 100644
--- a/nova/tests/unit/test_rpc.py
+++ b/nova/tests/unit/test_rpc.py
@@ -16,7 +16,6 @@ import mock
import oslo_messaging as messaging
from oslo_messaging.rpc import dispatcher
from oslo_serialization import jsonutils
-import six
import nova.conf
from nova import context
@@ -354,7 +353,7 @@ class TestJsonPayloadSerializer(test.NoDBTestCase):
self.assertIsInstance(primitive, dict)
# Convert anything else, should get a string.
primitive = rpc.JsonPayloadSerializer.fallback(mock.sentinel.entity)
- self.assertIsInstance(primitive, six.text_type)
+ self.assertIsInstance(primitive, str)
class TestRequestContextSerializer(test.NoDBTestCase):
diff --git a/nova/tests/unit/test_test.py b/nova/tests/unit/test_test.py
index 78bb36815b..97a1f7792f 100644
--- a/nova/tests/unit/test_test.py
+++ b/nova/tests/unit/test_test.py
@@ -23,7 +23,6 @@ import uuid
import mock
from oslo_log import log as logging
import oslo_messaging as messaging
-import six
import nova.conf
from nova import exception
@@ -125,10 +124,10 @@ class JsonTestCase(test.NoDBTestCase):
e.difference)
self.assertIn(
"actual:\n{'top': {'l1': {'l2': ['c', 'a', 'b', 'd']}}}",
- six.text_type(e))
+ str(e))
self.assertIn(
"expected:\n{'top': {'l1': {'l2': ['a', 'b', 'c']}}}",
- six.text_type(e))
+ str(e))
else:
self.fail("This should have raised a mismatch exception")
@@ -206,10 +205,10 @@ class JsonTestCase(test.NoDBTestCase):
e.difference)
self.assertIn(
"actual:\n{'top': {'l1': {'l2': ['c', 'a', 'd']}}}",
- six.text_type(e))
+ str(e))
self.assertIn(
"expected:\n{'top': {'l1': {'l2': ['a', 'b', 'c']}}}",
- six.text_type(e))
+ str(e))
else:
self.fail("This should have raised a mismatch exception")
@@ -233,11 +232,9 @@ class JsonTestCase(test.NoDBTestCase):
except Exception as e:
self.assertEqual(
"3 != 4: path: root.top.l1.l2.c", e.difference)
- self.assertIn("actual:\n{'top': {'l1': {'l2': {", six.text_type(e))
- self.assertIn(
- "expected:\n{'top': {'l1': {'l2': {", six.text_type(e))
- self.assertIn(
- "message: test message\n", six.text_type(e))
+ self.assertIn("actual:\n{'top': {'l1': {'l2': {", str(e))
+ self.assertIn("expected:\n{'top': {'l1': {'l2': {", str(e))
+ self.assertIn("message: test message\n", str(e))
else:
self.fail("This should have raised a mismatch exception")
@@ -310,13 +307,13 @@ class NovaExceptionReraiseFormatErrorTestCase(test.NoDBTestCase):
# wrong kwarg
ex = self.assertRaises(KeyError, FakeImageException,
bogus='wrongkwarg')
- self.assertIn('image_id', six.text_type(ex))
+ self.assertIn('image_id', str(ex))
# no kwarg
ex = self.assertRaises(KeyError, FakeImageException)
- self.assertIn('image_id', six.text_type(ex))
+ self.assertIn('image_id', str(ex))
# not enough kwargs
ex = self.assertRaises(KeyError, FakeImageException, image_id='image')
- self.assertIn('type', six.text_type(ex))
+ self.assertIn('type', str(ex))
class PatchExistsTestCase(test.NoDBTestCase):
diff --git a/nova/tests/unit/test_utils.py b/nova/tests/unit/test_utils.py
index dce9430be9..03f565b7e4 100644
--- a/nova/tests/unit/test_utils.py
+++ b/nova/tests/unit/test_utils.py
@@ -31,7 +31,6 @@ from oslo_context import fixture as context_fixture
from oslo_utils import encodeutils
from oslo_utils import fixture as utils_fixture
from oslo_utils.secretutils import md5
-import six
from nova import context
from nova import exception
@@ -215,8 +214,7 @@ class GenericUtilsTestCase(test.NoDBTestCase):
instance.display_name = u'\u00CD\u00F1st\u00E1\u00F1c\u00E9'
# should be a bytes string if python2 before conversion
self.assertIs(str, type(repr(instance)))
- self.assertIs(six.text_type,
- type(utils.get_obj_repr_unicode(instance)))
+ self.assertIs(str, type(utils.get_obj_repr_unicode(instance)))
@mock.patch('oslo_concurrency.processutils.execute')
def test_ssh_execute(self, mock_execute):
diff --git a/nova/tests/unit/virt/ironic/test_driver.py b/nova/tests/unit/virt/ironic/test_driver.py
index d2f584d9d6..54d910abea 100644
--- a/nova/tests/unit/virt/ironic/test_driver.py
+++ b/nova/tests/unit/virt/ironic/test_driver.py
@@ -23,7 +23,6 @@ from oslo_config import cfg
from oslo_service import loopingcall
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import uuidutils
-import six
from testtools import matchers
from tooz import hashring as hash_ring
@@ -2008,7 +2007,7 @@ class IronicDriverTestCase(test.NoDBTestCase):
instance = fake_instance.fake_instance_obj(self.ctx,
node=node_uuid)
network_info = utils.get_test_network_info()
- vif_id = six.text_type(network_info[0]['id'])
+ vif_id = str(network_info[0]['id'])
self.driver._plug_vifs(node, instance, network_info)
@@ -2133,7 +2132,7 @@ class IronicDriverTestCase(test.NoDBTestCase):
instance = fake_instance.fake_instance_obj(self.ctx,
node=node_id)
network_info = utils.get_test_network_info()
- vif_id = six.text_type(network_info[0]['id'])
+ vif_id = str(network_info[0]['id'])
self.driver.unplug_vifs(instance, network_info)
# asserts
diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py
index 77b93fc74f..ed49dbb4db 100644
--- a/nova/tests/unit/virt/libvirt/test_driver.py
+++ b/nova/tests/unit/virt/libvirt/test_driver.py
@@ -59,7 +59,6 @@ from oslo_utils import strutils
from oslo_utils import units
from oslo_utils import uuidutils
from oslo_utils import versionutils
-import six
from nova.api.metadata import base as instance_metadata
from nova.compute import manager
@@ -1448,7 +1447,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
self.assertIn(
"Reserving memory via '[DEFAULT] reserved_host_memory_mb' is not "
"compatible",
- six.text_type(mock_log.call_args[0]),
+ str(mock_log.call_args[0]),
)
def test__check_cpu_compatibility_start_ok(self):
@@ -1547,7 +1546,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
exc = self.assertRaises(exception.InvalidConfiguration,
drvr.init_host, 'dummyhost')
self.assertIn("vTPM support requires '[libvirt] virt_type' of 'qemu' "
- "or 'kvm'; found 'lxc'.", six.text_type(exc))
+ "or 'kvm'; found 'lxc'.", str(exc))
@mock.patch.object(host.Host, 'has_min_version', return_value=True)
@mock.patch('shutil.which')
@@ -1690,7 +1689,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
ex = self.assertRaises(exception.InvalidConfiguration,
drvr._check_cpu_set_configuration)
self.assertIn("The 'reserved_host_cpus' config option cannot be "
- "defined alongside ", six.text_type(ex))
+ "defined alongside ", str(ex))
@mock.patch.object(libvirt_driver.LOG, 'warning')
def test_check_cpu_set_configuration__vcpu_pin_set(self, mock_log):
@@ -1709,7 +1708,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
self.assertIn("When defined, 'vcpu_pin_set' will be used to calculate "
"'VCPU' inventory and schedule instances that have "
"'VCPU' allocations.",
- six.text_type(mock_log.call_args[0]))
+ str(mock_log.call_args[0]))
@mock.patch.object(libvirt_driver.LOG, 'warning')
def test_check_cpu_set_configuration__vcpu_pin_set_cpu_shared_set(
@@ -1728,7 +1727,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
mock_log.assert_called_once()
self.assertIn("The '[compute] cpu_shared_set' and 'vcpu_pin_set' "
"config options have both been defined.",
- six.text_type(mock_log.call_args[0]))
+ str(mock_log.call_args[0]))
def test_check_cpu_set_configuration__vcpu_pin_set_cpu_dedicated_set(
self):
@@ -1745,7 +1744,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
drvr._check_cpu_set_configuration)
self.assertIn("The 'vcpu_pin_set' config option has been deprecated "
"and cannot be defined alongside '[compute] "
- "cpu_dedicated_set'.", six.text_type(ex))
+ "cpu_dedicated_set'.", str(ex))
def _do_test_parse_migration_flags(self, lm_expected=None,
bm_expected=None):
@@ -2193,7 +2192,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
'provider status to "enabled" for provider: %s' %
uuids.rp_uuid, log_output)
# The error should have been logged as well.
- self.assertIn(six.text_type(error), log_output)
+ self.assertIn(str(error), log_output)
@mock.patch.object(fakelibvirt.virConnect, "nodeDeviceLookupByName")
def test_prepare_pci_device(self, mock_lookup):
@@ -19866,8 +19865,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
create=True) as mock_define:
srcfile = "/first/path"
dstfile = "/second/path"
- orig_xml = six.text_type(mock.sentinel.orig_xml)
- new_xml = six.text_type(mock.sentinel.new_xml)
+ orig_xml = str(mock.sentinel.orig_xml)
+ new_xml = str(mock.sentinel.new_xml)
mock_dom.XMLDesc.return_value = orig_xml
mock_dom.isPersistent.return_value = True
@@ -20515,7 +20514,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
image_meta=image_meta, disk_info=disk_info, accel_info=accel_info)
mock_add_accel.assert_called_once_with(mock.ANY, [])
self.assertIn('Ignoring accelerator requests for instance',
- six.text_type(mock_log.call_args[0]))
+ str(mock_log.call_args[0]))
def test_get_guest_disk_config_rbd_older_config_drive_fall_back(self):
# New config drives are stored in rbd but existing instances have
@@ -21507,7 +21506,7 @@ class TestUpdateProviderTree(test.NoDBTestCase):
self.pt, self.cn_rp['name'],
allocations=allocations)
self.assertIn('Unexpected VGPU resource allocation on provider %s'
- % uuids.other_rp, six.text_type(ex))
+ % uuids.other_rp, str(ex))
@mock.patch('nova.objects.instance.Instance.get_by_uuid')
@mock.patch('nova.objects.migration.MigrationList'
@@ -23654,7 +23653,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin):
self.assertFalse(mock_log.error.called)
self.assertEqual(1, mock_log.warning.call_count)
self.assertIn('the device is no longer found on the guest',
- six.text_type(mock_log.warning.call_args[0]))
+ str(mock_log.warning.call_args[0]))
@mock.patch('nova.virt.libvirt.driver.LOG')
def test_detach_interface_guest_not_found_after_detach(self, mock_log):
@@ -26710,7 +26709,7 @@ class LibvirtVolumeSnapshotTestCase(test.NoDBTestCase):
self.drvr._volume_snapshot_delete,
self.c, instance, self.volume_uuid,
snapshot_id, self.delete_info_1)
- self.assertIn('has not been fully tested', six.text_type(ex))
+ self.assertIn('has not been fully tested', str(ex))
@mock.patch('time.sleep', new=mock.Mock())
@mock.patch.object(host.Host, '_get_domain')
diff --git a/nova/tests/unit/virt/libvirt/test_guest.py b/nova/tests/unit/virt/libvirt/test_guest.py
index bbf35f0b30..2c7de622c1 100644
--- a/nova/tests/unit/virt/libvirt/test_guest.py
+++ b/nova/tests/unit/virt/libvirt/test_guest.py
@@ -19,7 +19,6 @@ import sys
import mock
from oslo_service import fixture as service_fixture
from oslo_utils import encodeutils
-import six
from nova import context
from nova import exception
@@ -280,7 +279,7 @@ class GuestTestCase(test.NoDBTestCase):
ex = self.assertRaises(
exception.DeviceNotFound, self.guest.detach_device_with_retry,
get_config, "/dev/vdb", live=True)
- self.assertIn("/dev/vdb", six.text_type(ex))
+ self.assertIn("/dev/vdb", str(ex))
def test_detach_device_with_retry_device_not_found_alt_name(self):
"""Tests to make sure we use the alternative name in errors."""
@@ -290,7 +289,7 @@ class GuestTestCase(test.NoDBTestCase):
exception.DeviceNotFound, self.guest.detach_device_with_retry,
get_config, mock.sentinel.device, live=True,
alternative_device_name='foo')
- self.assertIn('foo', six.text_type(ex))
+ self.assertIn('foo', str(ex))
@mock.patch.object(libvirt_guest.Guest, "detach_device")
def _test_detach_device_with_retry_second_detach_failure(
diff --git a/nova/tests/unit/virt/libvirt/test_migration.py b/nova/tests/unit/virt/libvirt/test_migration.py
index 6166458ccc..950ed67e8c 100644
--- a/nova/tests/unit/virt/libvirt/test_migration.py
+++ b/nova/tests/unit/virt/libvirt/test_migration.py
@@ -20,7 +20,6 @@ from lxml import etree
import mock
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import units
-import six
from nova.compute import power_state
from nova import exception
@@ -896,8 +895,7 @@ class UtilityMigrationTestCase(test.NoDBTestCase):
ex = self.assertRaises(exception.NovaException,
migration._update_vif_xml,
doc, data, get_vif_config)
- self.assertIn('Unable to find MAC address in interface XML',
- six.text_type(ex))
+ self.assertIn('Unable to find MAC address in interface XML', str(ex))
def test_update_vif_xml_no_matching_vif(self):
"""Tests that the vif in the migrate data is not found in the existing
@@ -921,7 +919,7 @@ class UtilityMigrationTestCase(test.NoDBTestCase):
doc = etree.fromstring(original_xml)
ex = self.assertRaises(KeyError, migration._update_vif_xml,
doc, data, get_vif_config)
- self.assertIn("CA:FE:DE:AD:BE:EF", six.text_type(ex))
+ self.assertIn("CA:FE:DE:AD:BE:EF", str(ex))
class MigrationMonitorTestCase(test.NoDBTestCase):
diff --git a/nova/tests/unit/virt/libvirt/test_vif.py b/nova/tests/unit/virt/libvirt/test_vif.py
index a3a7819071..7b6dde6423 100644
--- a/nova/tests/unit/virt/libvirt/test_vif.py
+++ b/nova/tests/unit/virt/libvirt/test_vif.py
@@ -22,7 +22,6 @@ from os_vif.objects import fields as osv_fields
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_utils.fixture import uuidsentinel as uuids
-import six
from nova import exception
from nova.network import model as network_model
@@ -1215,9 +1214,9 @@ class LibvirtVifTestCase(test.NoDBTestCase):
self._get_instance_xml,
d,
self.vif_macvtap_exception)
- self.assertIn('macvtap_source', six.text_type(e))
- self.assertIn('macvtap_mode', six.text_type(e))
- self.assertIn('physical_interface', six.text_type(e))
+ self.assertIn('macvtap_source', str(e))
+ self.assertIn('macvtap_mode', str(e))
+ self.assertIn('physical_interface', str(e))
@mock.patch('nova.virt.libvirt.vif.ensure_vlan')
def test_macvtap_plug_vlan(self, ensure_vlan_mock):
diff --git a/nova/tests/unit/virt/libvirt/volume/test_quobyte.py b/nova/tests/unit/virt/libvirt/volume/test_quobyte.py
index 5e6aba3cd2..8a0c647fc8 100644
--- a/nova/tests/unit/virt/libvirt/volume/test_quobyte.py
+++ b/nova/tests/unit/virt/libvirt/volume/test_quobyte.py
@@ -22,7 +22,6 @@ import mock
from oslo_concurrency import processutils
from oslo_utils import fileutils
import psutil
-import six
from nova import exception as nova_exception
from nova import test
@@ -51,7 +50,7 @@ class QuobyteTestCase(test.NoDBTestCase):
self.assertIsInstance(exc, excClass,
'Wrong exception caught: %s Stacktrace: %s' %
(exc, traceback.format_exc()))
- self.assertIn(msg, six.text_type(exc))
+ self.assertIn(msg, str(exc))
if not caught:
self.fail('Expected raised exception but nothing caught.')
diff --git a/nova/tests/unit/virt/powervm/test_driver.py b/nova/tests/unit/virt/powervm/test_driver.py
index 25e99cd4b6..025d823d15 100644
--- a/nova/tests/unit/virt/powervm/test_driver.py
+++ b/nova/tests/unit/virt/powervm/test_driver.py
@@ -24,7 +24,6 @@ from pypowervm.helpers import log_helper as pvm_hlp_log
from pypowervm.helpers import vios_busy as pvm_hlp_vbusy
from pypowervm.utils import transaction as pvm_tx
from pypowervm.wrappers import virtual_io_server as pvm_vios
-import six
from nova import block_device as nova_block_device
from nova.compute import provider_tree
@@ -505,11 +504,11 @@ class TestPowerVMDriver(test.NoDBTestCase):
mock_tf_run.side_effect = exception.InstanceNotFound('id')
exc = self.assertRaises(exception.VirtualInterfacePlugException,
self.drv.plug_vifs, mock_inst, 'net_info')
- self.assertIn('instance', six.text_type(exc))
+ self.assertIn('instance', str(exc))
mock_tf_run.side_effect = Exception
exc = self.assertRaises(exception.VirtualInterfacePlugException,
self.drv.plug_vifs, mock_inst, 'net_info')
- self.assertIn('unexpected', six.text_type(exc))
+ self.assertIn('unexpected', str(exc))
@mock.patch('nova.virt.powervm.tasks.base.run', autospec=True)
@mock.patch('nova.virt.powervm.tasks.network.UnplugVifs', autospec=True)
diff --git a/nova/tests/unit/virt/test_images.py b/nova/tests/unit/virt/test_images.py
index 199d4cf8e1..085b169db3 100644
--- a/nova/tests/unit/virt/test_images.py
+++ b/nova/tests/unit/virt/test_images.py
@@ -16,7 +16,6 @@ import os
import mock
from oslo_concurrency import processutils
-import six
from nova.compute import utils as compute_utils
from nova import exception
@@ -78,7 +77,7 @@ class QemuTestCase(test.NoDBTestCase):
exc = self.assertRaises(exception.InvalidDiskInfo,
images.qemu_img_info,
'/fake/path')
- self.assertIn('qemu-img aborted by prlimits', six.text_type(exc))
+ self.assertIn('qemu-img aborted by prlimits', str(exc))
@mock.patch('oslo_concurrency.processutils.execute')
@mock.patch.object(os.path, 'exists', return_value=True)
diff --git a/nova/tests/unit/virt/test_virt.py b/nova/tests/unit/virt/test_virt.py
index ca46bc5b39..11f306c761 100644
--- a/nova/tests/unit/virt/test_virt.py
+++ b/nova/tests/unit/virt/test_virt.py
@@ -17,7 +17,6 @@ import io
import mock
import os_traits
-import six
from nova import test
from nova.virt.disk import api as disk_api
@@ -133,7 +132,7 @@ class FakeMount(object):
class TestDiskImage(test.NoDBTestCase):
def mock_proc_mounts(self, mock_open):
- response = io.StringIO(six.text_type(PROC_MOUNTS_CONTENTS))
+ response = io.StringIO(str(PROC_MOUNTS_CONTENTS))
mock_open.return_value = response
@mock.patch('builtins.open')
diff --git a/nova/tests/unit/virt/vmwareapi/test_vmops.py b/nova/tests/unit/virt/vmwareapi/test_vmops.py
index 102f6e5059..8eb77ec927 100644
--- a/nova/tests/unit/virt/vmwareapi/test_vmops.py
+++ b/nova/tests/unit/virt/vmwareapi/test_vmops.py
@@ -23,7 +23,6 @@ from oslo_utils import uuidutils
from oslo_vmware import exceptions as vexc
from oslo_vmware.objects import datastore as ds_obj
from oslo_vmware import vim_util as vutil
-import six
from nova.compute import power_state
from nova import context
@@ -1734,9 +1733,9 @@ class VMwareVMOpsTestCase(test.NoDBTestCase):
self._verify_spawn_method_calls(_call_method, extras)
dc_ref = 'fake_dc_ref'
- source_file = six.text_type('[fake_ds] vmware_base/%s/%s.vmdk' %
+ source_file = ('[fake_ds] vmware_base/%s/%s.vmdk' %
(self._image_id, self._image_id))
- dest_file = six.text_type('[fake_ds] vmware_base/%s/%s.%d.vmdk' %
+ dest_file = ('[fake_ds] vmware_base/%s/%s.%d.vmdk' %
(self._image_id, self._image_id,
self._instance['root_gb']))
# TODO(dims): add more tests for copy_virtual_disk after
diff --git a/nova/tests/unit/volume/test_cinder.py b/nova/tests/unit/volume/test_cinder.py
index 4ca8e4ee3e..0d53ab2c69 100644
--- a/nova/tests/unit/volume/test_cinder.py
+++ b/nova/tests/unit/volume/test_cinder.py
@@ -23,7 +23,6 @@ from keystoneclient import exceptions as keystone_exception
import mock
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import timeutils
-import six
import nova.conf
from nova import context
@@ -218,7 +217,7 @@ class CinderApiTestCase(test.NoDBTestCase):
ex = self.assertRaises(exception.NotFound,
self.api.create, self.ctx, 1, '', '')
- self.assertEqual('Volume type can not be found.', six.text_type(ex))
+ self.assertEqual('Volume type can not be found.', str(ex))
@mock.patch('nova.volume.cinder.cinderclient')
def test_create_over_quota_failed(self, mock_cinderclient):
@@ -531,7 +530,7 @@ class CinderApiTestCase(test.NoDBTestCase):
attachment_id)
self.assertEqual(404, ex.code)
- self.assertIn(attachment_id, six.text_type(ex))
+ self.assertIn(attachment_id, str(ex))
@mock.patch('nova.volume.cinder.cinderclient',
side_effect=exception.CinderAPIVersionNotAvailable(
@@ -604,7 +603,7 @@ class CinderApiTestCase(test.NoDBTestCase):
attachment_id)
self.assertEqual(404, ex.code)
- self.assertIn(attachment_id, six.text_type(ex))
+ self.assertIn(attachment_id, str(ex))
@mock.patch('nova.volume.cinder.cinderclient',
side_effect=exception.CinderAPIVersionNotAvailable(
@@ -725,7 +724,7 @@ class CinderApiTestCase(test.NoDBTestCase):
attachment_id)
self.assertEqual(404, ex.code)
- self.assertIn(attachment_id, six.text_type(ex))
+ self.assertIn(attachment_id, str(ex))
@mock.patch('nova.volume.cinder.cinderclient',
side_effect=exception.CinderAPIVersionNotAvailable(