From 7a8f29dffea6c203e3c31f28fc06161a5de3d4f1 Mon Sep 17 00:00:00 2001 From: zhufl Date: Fri, 17 Feb 2017 10:16:45 +0800 Subject: [PATCH] Change instance variable to local variable in scenario/image/volume There are still some unnecessary instance variables, and this is to change them to local variables. Change-Id: I9c9e25255e9d84639122156a618f266b91818743 --- tempest/api/image/v1/test_images.py | 12 ++++++------ tempest/api/volume/test_volumes_extend.py | 10 +++++----- tempest/scenario/test_aggregates_basic_ops.py | 5 ++--- tempest/scenario/test_network_basic_ops.py | 8 ++++---- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/tempest/api/image/v1/test_images.py b/tempest/api/image/v1/test_images.py index a79c18c71e..756c78ce8e 100644 --- a/tempest/api/image/v1/test_images.py +++ b/tempest/api/image/v1/test_images.py @@ -145,24 +145,24 @@ class ListImagesTest(base.BaseV1ImageTest): a_formats = ['ami', 'ari', 'aki'] (cls.container_format, - cls.container_format_alt) = CONF.image.container_formats[:2] + container_format_alt) = CONF.image.container_formats[:2] cls.disk_format, cls.disk_format_alt = CONF.image.disk_formats[:2] if cls.container_format in a_formats: cls.disk_format = cls.container_format - if cls.container_format_alt in a_formats: - cls.disk_format_alt = cls.container_format_alt + if container_format_alt in a_formats: + cls.disk_format_alt = container_format_alt img1 = cls._create_remote_image('one', cls.container_format, cls.disk_format) - img2 = cls._create_remote_image('two', cls.container_format_alt, + img2 = cls._create_remote_image('two', container_format_alt, cls.disk_format_alt) img3 = cls._create_remote_image('dup', cls.container_format, cls.disk_format) img4 = cls._create_remote_image('dup', cls.container_format, cls.disk_format) - img5 = cls._create_standard_image('1', cls.container_format_alt, + img5 = cls._create_standard_image('1', container_format_alt, cls.disk_format_alt, 42) - img6 = cls._create_standard_image('2', cls.container_format_alt, + img6 = cls._create_standard_image('2', container_format_alt, cls.disk_format_alt, 142) img7 = cls._create_standard_image('33', cls.container_format, cls.disk_format, 142) diff --git a/tempest/api/volume/test_volumes_extend.py b/tempest/api/volume/test_volumes_extend.py index 20118dfb80..2e1851ef57 100644 --- a/tempest/api/volume/test_volumes_extend.py +++ b/tempest/api/volume/test_volumes_extend.py @@ -23,13 +23,13 @@ class VolumesV2ExtendTest(base.BaseVolumeTest): @decorators.idempotent_id('9a36df71-a257-43a5-9555-dc7c88e66e0e') def test_volume_extend(self): # Extend Volume Test. - self.volume = self.create_volume() - extend_size = int(self.volume['size']) + 1 - self.volumes_client.extend_volume(self.volume['id'], + volume = self.create_volume() + extend_size = int(volume['size']) + 1 + self.volumes_client.extend_volume(volume['id'], new_size=extend_size) waiters.wait_for_volume_status(self.volumes_client, - self.volume['id'], 'available') - volume = self.volumes_client.show_volume(self.volume['id'])['volume'] + volume['id'], 'available') + volume = self.volumes_client.show_volume(volume['id'])['volume'] self.assertEqual(int(volume['size']), extend_size) diff --git a/tempest/scenario/test_aggregates_basic_ops.py b/tempest/scenario/test_aggregates_basic_ops.py index 50fe9c8c5e..95c2d322c4 100644 --- a/tempest/scenario/test_aggregates_basic_ops.py +++ b/tempest/scenario/test_aggregates_basic_ops.py @@ -36,9 +36,8 @@ class TestAggregatesBasicOps(manager.ScenarioTest): def setup_clients(cls): super(TestAggregatesBasicOps, cls).setup_clients() # Use admin client by default - cls.manager = cls.admin_manager - cls.aggregates_client = cls.manager.aggregates_client - cls.hosts_client = cls.manager.hosts_client + cls.aggregates_client = cls.admin_manager.aggregates_client + cls.hosts_client = cls.admin_manager.hosts_client def _create_aggregate(self, **kwargs): aggregate = (self.aggregates_client.create_aggregate(**kwargs) diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py index e6a5f515c6..4dae564e2d 100644 --- a/tempest/scenario/test_network_basic_ops.py +++ b/tempest/scenario/test_network_basic_ops.py @@ -109,13 +109,13 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest): self.check_networks() self.ports = [] - self.port_id = None + port_id = None if boot_with_port: # create a port on the network and boot with that - self.port_id = self._create_port(self.network['id'])['id'] - self.ports.append({'port': self.port_id}) + port_id = self._create_port(self.network['id'])['id'] + self.ports.append({'port': port_id}) - server = self._create_server(self.network, self.port_id) + server = self._create_server(self.network, port_id) self._check_tenant_network_connectivity() floating_ip = self.create_floating_ip(server)