Merge "Remove usage of six"
This commit is contained in:
commit
8791b6e969
|
@ -13,7 +13,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
import io
|
||||
|
||||
from tempest.api.compute import base
|
||||
from tempest.common import waiters
|
||||
|
@ -51,7 +51,7 @@ class BaseAttachSCSIVolumeTest(base.BaseV2ComputeAdminTest):
|
|||
image = self.image_client.show_image(CONF.compute.image_ref)
|
||||
image_data = self.image_client.show_image_file(
|
||||
CONF.compute.image_ref).data
|
||||
image_file = six.BytesIO(image_data)
|
||||
image_file = io.BytesIO(image_data)
|
||||
create_dict = {
|
||||
'container_format': image['container_format'],
|
||||
'disk_format': image['disk_format'],
|
||||
|
|
|
@ -13,10 +13,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import io
|
||||
import random
|
||||
|
||||
import six
|
||||
|
||||
from tempest.api.compute import base
|
||||
from tempest.common import image as common_image
|
||||
from tempest.common import utils
|
||||
|
@ -44,7 +43,7 @@ class FlavorsV2NegativeTest(base.BaseV2ComputeTest):
|
|||
CONF.compute.flavor_ref)['flavor']
|
||||
min_img_ram = flavor['ram'] + 1
|
||||
size = random.randint(1024, 4096)
|
||||
image_file = six.BytesIO(data_utils.random_bytes(size))
|
||||
image_file = io.BytesIO(data_utils.random_bytes(size))
|
||||
params = {
|
||||
'name': data_utils.rand_name('image'),
|
||||
'container_format': CONF.image.container_formats[0],
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
import io
|
||||
|
||||
from tempest.api.compute import base
|
||||
from tempest.common import image as common_image
|
||||
|
@ -77,7 +77,7 @@ class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
|
|||
cls.addClassResourceCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
cls.glance_client.delete_image,
|
||||
cls.image_id)
|
||||
image_file = six.BytesIO((b'*' * 1024))
|
||||
image_file = io.BytesIO((b'*' * 1024))
|
||||
if CONF.image_feature_enabled.api_v1:
|
||||
cls.glance_client.update_image(cls.image_id, data=image_file)
|
||||
else:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
import time
|
||||
|
||||
import six
|
||||
import io
|
||||
import testtools
|
||||
|
||||
from tempest.api.compute import base
|
||||
|
@ -85,7 +85,7 @@ class ListImageFiltersTestJSON(base.BaseV2ComputeTest):
|
|||
# Wait 1 second between creation and upload to ensure a delta
|
||||
# between created_at and updated_at.
|
||||
time.sleep(1)
|
||||
image_file = six.BytesIO((b'*' * 1024))
|
||||
image_file = io.BytesIO((b'*' * 1024))
|
||||
if CONF.image_feature_enabled.api_v1:
|
||||
cls.glance_client.update_image(image_id, data=image_file)
|
||||
else:
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
import io
|
||||
|
||||
from tempest.common import image as common_image
|
||||
from tempest import config
|
||||
|
@ -113,7 +113,7 @@ class BaseV1ImageMembersTest(BaseV1ImageTest):
|
|||
cls.alt_tenant_id = cls.alt_image_member_client.tenant_id
|
||||
|
||||
def _create_image(self):
|
||||
image_file = six.BytesIO(data_utils.random_bytes())
|
||||
image_file = io.BytesIO(data_utils.random_bytes())
|
||||
image = self.create_image(container_format='bare',
|
||||
disk_format='raw',
|
||||
is_public=False,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
import io
|
||||
|
||||
from tempest.api.image import base
|
||||
from tempest.common import image as common_image
|
||||
|
@ -72,7 +72,7 @@ class CreateRegisterImagesTest(base.BaseV1ImageTest):
|
|||
self.assertEqual(val, image.get('properties')[key])
|
||||
|
||||
# Now try uploading an image file
|
||||
image_file = six.BytesIO(data_utils.random_bytes())
|
||||
image_file = io.BytesIO(data_utils.random_bytes())
|
||||
body = self.client.update_image(image['id'], data=image_file)['image']
|
||||
self.assertIn('size', body)
|
||||
self.assertEqual(1024, body.get('size'))
|
||||
|
@ -204,7 +204,7 @@ class ListImagesTest(base.BaseV1ImageTest):
|
|||
Note that the size of the new image is a random number between
|
||||
1024 and 4096
|
||||
"""
|
||||
image_file = six.BytesIO(data_utils.random_bytes(size))
|
||||
image_file = io.BytesIO(data_utils.random_bytes(size))
|
||||
name = 'New Standard Image %s' % name
|
||||
image = cls.create_image(name=name,
|
||||
container_format=container_format,
|
||||
|
@ -306,7 +306,7 @@ class UpdateImageMetaTest(base.BaseV1ImageTest):
|
|||
disk_format, size):
|
||||
"""Create a new standard image and return newly-registered image-id"""
|
||||
|
||||
image_file = six.BytesIO(data_utils.random_bytes(size))
|
||||
image_file = io.BytesIO(data_utils.random_bytes(size))
|
||||
name = 'New Standard Image %s' % name
|
||||
image = cls.create_image(name=name,
|
||||
container_format=container_format,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
import io
|
||||
|
||||
from tempest.api.image import base
|
||||
from tempest.common import waiters
|
||||
|
@ -99,7 +99,7 @@ class ImportCopyImagesTest(base.BaseV2ImageAdminTest):
|
|||
self.assertEqual('queued', image['status'])
|
||||
|
||||
file_content = data_utils.random_bytes()
|
||||
image_file = six.BytesIO(file_content)
|
||||
image_file = io.BytesIO(file_content)
|
||||
self.client.store_image_file(image['id'], image_file)
|
||||
|
||||
body = self.client.show_image(image['id'])
|
||||
|
|
|
@ -14,10 +14,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import io
|
||||
import random
|
||||
|
||||
import six
|
||||
|
||||
from oslo_log import log as logging
|
||||
from tempest.api.image import base
|
||||
from tempest.common import waiters
|
||||
|
@ -82,7 +81,7 @@ class ImportImagesTest(base.BaseV2ImageTest):
|
|||
image = self._create_image()
|
||||
# Stage image data
|
||||
file_content = data_utils.random_bytes()
|
||||
image_file = six.BytesIO(file_content)
|
||||
image_file = io.BytesIO(file_content)
|
||||
self.client.stage_image_file(image['id'], image_file)
|
||||
# Check image status is 'uploading'
|
||||
body = self.client.show_image(image['id'])
|
||||
|
@ -158,7 +157,7 @@ class MultiStoresImportImagesTest(base.BaseV2ImageTest):
|
|||
|
||||
self.client.stage_image_file(
|
||||
image['id'],
|
||||
six.BytesIO(data_utils.random_bytes()))
|
||||
io.BytesIO(data_utils.random_bytes()))
|
||||
# Check image status is 'uploading'
|
||||
body = self.client.show_image(image['id'])
|
||||
self.assertEqual(image['id'], body['id'])
|
||||
|
@ -240,7 +239,7 @@ class BasicOperationsImagesTest(base.BaseV2ImageTest):
|
|||
|
||||
# Now try uploading an image file
|
||||
file_content = data_utils.random_bytes()
|
||||
image_file = six.BytesIO(file_content)
|
||||
image_file = io.BytesIO(file_content)
|
||||
self.client.store_image_file(image['id'], image_file)
|
||||
|
||||
# Now try to get image details
|
||||
|
@ -317,7 +316,7 @@ class BasicOperationsImagesTest(base.BaseV2ImageTest):
|
|||
|
||||
# Upload an image file
|
||||
content = data_utils.random_bytes()
|
||||
image_file = six.BytesIO(content)
|
||||
image_file = io.BytesIO(content)
|
||||
self.client.store_image_file(image['id'], image_file)
|
||||
|
||||
# Deactivate image
|
||||
|
@ -367,7 +366,7 @@ class ListUserImagesTest(base.BaseV2ImageTest):
|
|||
1024 and 4096
|
||||
"""
|
||||
size = random.randint(1024, 4096)
|
||||
image_file = six.BytesIO(data_utils.random_bytes(size))
|
||||
image_file = io.BytesIO(data_utils.random_bytes(size))
|
||||
tags = [data_utils.rand_name('tag'), data_utils.rand_name('tag')]
|
||||
image = cls.create_image(container_format=container_format,
|
||||
disk_format=disk_format,
|
||||
|
@ -550,7 +549,7 @@ class ListSharedImagesTest(base.BaseV2ImageTest):
|
|||
def test_list_images_param_member_status(self):
|
||||
"""Test listing images by member_status and visibility"""
|
||||
# Create an image to be shared using default visibility
|
||||
image_file = six.BytesIO(data_utils.random_bytes(2048))
|
||||
image_file = io.BytesIO(data_utils.random_bytes(2048))
|
||||
container_format = CONF.image.container_formats[0]
|
||||
disk_format = CONF.image.disk_formats[0]
|
||||
image = self.create_image(container_format=container_format,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
import io
|
||||
|
||||
from tempest.api.volume import base
|
||||
from tempest.common import utils
|
||||
|
@ -50,7 +50,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
|
|||
self.images_client.delete_image, image['id'])
|
||||
|
||||
# Upload image with 1KB data
|
||||
image_file = six.BytesIO(data_utils.random_bytes())
|
||||
image_file = io.BytesIO(data_utils.random_bytes())
|
||||
self.images_client.store_image_file(image['id'], image_file)
|
||||
waiters.wait_for_image_status(self.images_client,
|
||||
image['id'], 'active')
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
import io
|
||||
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.services.image.v2 import images_client
|
||||
|
@ -178,7 +178,7 @@ class TestImagesClient(base.BaseServiceTest):
|
|||
{}, image_id="e485aab9-0907-4973-921c-bb6da8a8fcf8", status=204)
|
||||
|
||||
def test_store_image_file(self):
|
||||
data = six.BytesIO(data_utils.random_bytes())
|
||||
data = io.BytesIO(data_utils.random_bytes())
|
||||
|
||||
self.check_service_client_function(
|
||||
self.client.store_image_file,
|
||||
|
|
Loading…
Reference in New Issue