Remove six of dir cinder/tests/unit/volume&zonemanager/*
Replace the following items with Python 3 style code. - six.text_type - six.StringIO - six.binary_type - six.moves Change-Id: If6c758dbca6e64f3f0276bf4d9126bc399bf59d1 Implements: blueprint six-removal
This commit is contained in:
parent
6ad1ab0c72
commit
02615bfe38
|
@ -22,7 +22,6 @@ from castellan.common import exception as castellan_exc
|
|||
from castellan.tests.unit.key_manager import mock_key_manager
|
||||
import ddt
|
||||
from oslo_utils import imageutils
|
||||
import six
|
||||
|
||||
from cinder import context
|
||||
from cinder import exception
|
||||
|
@ -459,7 +458,7 @@ class CreateVolumeFlowTestCase(test.TestCase):
|
|||
fake_get_qos,
|
||||
fake_is_encrypted):
|
||||
fake_image_service = fake_image.FakeImageService()
|
||||
image_id = six.text_type(uuid.uuid4())
|
||||
image_id = str(uuid.uuid4())
|
||||
image_meta = {}
|
||||
image_meta['id'] = image_id
|
||||
image_meta['status'] = 'active'
|
||||
|
@ -513,7 +512,7 @@ class CreateVolumeFlowTestCase(test.TestCase):
|
|||
def test__extract_availability_zones_az_not_specified(self, type_azs,
|
||||
self_azs, expected):
|
||||
fake_image_service = fake_image.FakeImageService()
|
||||
image_id = six.text_type(uuid.uuid4())
|
||||
image_id = str(uuid.uuid4())
|
||||
image_meta = {}
|
||||
image_meta['id'] = image_id
|
||||
image_meta['status'] = 'active'
|
||||
|
@ -539,7 +538,7 @@ class CreateVolumeFlowTestCase(test.TestCase):
|
|||
def test__extract_availability_zones_az_not_in_type_azs(self):
|
||||
self.override_config('allow_availability_zone_fallback', False)
|
||||
fake_image_service = fake_image.FakeImageService()
|
||||
image_id = six.text_type(uuid.uuid4())
|
||||
image_id = str(uuid.uuid4())
|
||||
image_meta = {}
|
||||
image_meta['id'] = image_id
|
||||
image_meta['status'] = 'active'
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
import datetime
|
||||
import enum
|
||||
import io
|
||||
import time
|
||||
from unittest import mock
|
||||
|
||||
|
@ -28,7 +29,6 @@ import os_brick.initiator.connectors.iscsi
|
|||
from oslo_concurrency import processutils
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import imageutils
|
||||
import six
|
||||
from taskflow.engines.action_engine import engine
|
||||
|
||||
from cinder.api import common
|
||||
|
@ -2011,8 +2011,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
|
|||
ex = self.assertRaises(exception.InvalidVolume,
|
||||
self.volume_api._attachment_reserve,
|
||||
self.context, volume, fake.UUID2)
|
||||
self.assertIn("status must be available or downloading",
|
||||
six.text_type(ex))
|
||||
self.assertIn("status must be available or downloading", str(ex))
|
||||
|
||||
def test_attachment_reserve_with_instance_uuid_error_volume(self):
|
||||
# Tests that trying to create an attachment (with an instance_uuid
|
||||
|
@ -2029,8 +2028,7 @@ class VolumeTestCase(base.BaseVolumeTestCase):
|
|||
ex = self.assertRaises(exception.InvalidVolume,
|
||||
self.volume_api._attachment_reserve,
|
||||
self.context, volume, fake.UUID1)
|
||||
self.assertIn("status must be available or downloading",
|
||||
six.text_type(ex))
|
||||
self.assertIn("status must be available or downloading", str(ex))
|
||||
|
||||
def test_unreserve_volume_success_in_use(self):
|
||||
volume = tests_utils.create_volume(self.context, status='attaching')
|
||||
|
@ -3354,7 +3352,7 @@ class VolumeTestCaseLocks(base.BaseVolumeTestCase):
|
|||
# source volume was deleted while the create was locked. Note that the
|
||||
# volume is still in the db since it was created by the test prior to
|
||||
# calling manager.create_volume.
|
||||
with mock.patch('sys.stderr', new=six.StringIO()):
|
||||
with mock.patch('sys.stderr', new=io.StringIO()):
|
||||
self.assertRaises(exception.VolumeNotFound, gthreads[0].wait)
|
||||
|
||||
def test_create_volume_from_snapshot_delete_lock_taken(self):
|
||||
|
@ -3404,7 +3402,7 @@ class VolumeTestCaseLocks(base.BaseVolumeTestCase):
|
|||
# snapshot was deleted while the create was locked. Note that the
|
||||
# volume is still in the db since it was created by the test prior to
|
||||
# calling manager.create_volume.
|
||||
with mock.patch('sys.stderr', new=six.StringIO()):
|
||||
with mock.patch('sys.stderr', new=io.StringIO()):
|
||||
self.assertRaises(exception.SnapshotNotFound, gthreads[0].wait)
|
||||
# locked
|
||||
self.volume.delete_volume(self.context, src_vol)
|
||||
|
|
|
@ -20,7 +20,6 @@ from unittest import mock
|
|||
from unittest.mock import patch
|
||||
|
||||
from oslo_utils import encodeutils
|
||||
import six
|
||||
|
||||
from cinder.tests.unit import test
|
||||
from cinder.zonemanager.drivers.brocade import (brcd_http_fc_zone_client
|
||||
|
@ -613,7 +612,7 @@ class TestBrcdHttpFCZoneClient(client.BrcdHTTPFCZoneClient, test.TestCase):
|
|||
new_ifas = {'fa1': u'20:15:f4:ce:96:ae:68:6c;20:11:f4:ce:46:ae:68:6c'}
|
||||
self.assertEqual(type(self.form_zone_string(
|
||||
cfgs, active_cfg, zones, new_alias, new_qlps, new_ifas, True)),
|
||||
six.binary_type)
|
||||
bytes)
|
||||
self.assertEqual(
|
||||
encodeutils.safe_encode(mocked_zone_string),
|
||||
self.form_zone_string(
|
||||
|
|
|
@ -21,7 +21,6 @@ import time
|
|||
from unittest import mock
|
||||
|
||||
from oslo_concurrency import processutils
|
||||
from six.moves import range
|
||||
|
||||
from cinder.tests.unit import test
|
||||
from cinder.zonemanager.drivers.cisco \
|
||||
|
|
Loading…
Reference in New Issue