From 5c39464c50b39ca9545f46a48564e1b495fd2c45 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Fri, 2 Mar 2012 00:08:25 +0000 Subject: Remove empty setUp/tearDown methods Python will call into the parent classes implementation of setUp/tearDown if there is no implementation in the child Also, make sure all setUp implementations subclassed off test.TestClass call the parent setUp so everything gets setup correctly Change-Id: If410cd412d9557a0d3172ec96b592fbd3fd67ffd --- .../api/openstack/compute/contrib/test_createserverext.py | 7 ------- nova/tests/api/openstack/compute/contrib/test_flavor_manage.py | 3 --- .../api/openstack/compute/contrib/test_security_groups.py | 6 ------ .../api/openstack/compute/contrib/test_server_start_stop.py | 3 --- .../api/openstack/compute/contrib/test_virtual_interfaces.py | 3 --- nova/tests/api/openstack/compute/contrib/test_volumes.py | 3 --- nova/tests/api/openstack/compute/contrib/test_vsa.py | 6 ------ nova/tests/api/openstack/compute/test_limits.py | 5 +---- nova/tests/api/openstack/compute/test_server_actions.py | 4 +--- nova/tests/api/openstack/volume/test_volumes.py | 3 --- nova/tests/api/test_auth.py | 4 +--- nova/tests/rpc/test_carrot.py | 3 --- nova/tests/rpc/test_fake.py | 3 --- nova/tests/rpc/test_kombu_ssl.py | 2 +- nova/tests/scheduler/test_host_manager.py | 3 --- nova/tests/scheduler/test_least_cost.py | 10 ---------- nova/tests/test_SolidFireSanISCSIDriver.py | 3 --- nova/tests/test_bdm.py | 6 ------ nova/tests/test_compute.py | 6 ------ nova/tests/test_consoleauth.py | 3 --- nova/tests/test_db_api.py | 3 --- nova/tests/test_nova_rootwrap.py | 3 --- nova/tests/test_signer.py | 3 --- nova/tests/test_xenapi.py | 3 --- 24 files changed, 4 insertions(+), 94 deletions(-) diff --git a/nova/tests/api/openstack/compute/contrib/test_createserverext.py b/nova/tests/api/openstack/compute/contrib/test_createserverext.py index e78f8cfd1..382d26e69 100644 --- a/nova/tests/api/openstack/compute/contrib/test_createserverext.py +++ b/nova/tests/api/openstack/compute/contrib/test_createserverext.py @@ -61,13 +61,6 @@ def return_instance_add_security_group(context, instance_id, class CreateserverextTest(test.TestCase): - - def setUp(self): - super(CreateserverextTest, self).setUp() - - def tearDown(self): - super(CreateserverextTest, self).tearDown() - def _make_stub_method(self, canned_return): def stub_method(*args, **kwargs): return canned_return diff --git a/nova/tests/api/openstack/compute/contrib/test_flavor_manage.py b/nova/tests/api/openstack/compute/contrib/test_flavor_manage.py index 8a18c1ab2..0639d99cc 100644 --- a/nova/tests/api/openstack/compute/contrib/test_flavor_manage.py +++ b/nova/tests/api/openstack/compute/contrib/test_flavor_manage.py @@ -80,9 +80,6 @@ class FlavorManageTest(test.TestCase): self.controller = flavormanage.FlavorManageController() - def tearDown(self): - super(FlavorManageTest, self).tearDown() - def test_delete(self): req = fakes.HTTPRequest.blank('/v2/123/flavors/1234') res = self.controller._delete(req, 1234) diff --git a/nova/tests/api/openstack/compute/contrib/test_security_groups.py b/nova/tests/api/openstack/compute/contrib/test_security_groups.py index a64ec7b6f..782eb409b 100644 --- a/nova/tests/api/openstack/compute/contrib/test_security_groups.py +++ b/nova/tests/api/openstack/compute/contrib/test_security_groups.py @@ -115,9 +115,6 @@ class TestSecurityGroups(test.TestCase): security_groups.ServerSecurityGroupController()) self.manager = security_groups.SecurityGroupActionController() - def tearDown(self): - super(TestSecurityGroups, self).tearDown() - def test_create_security_group(self): sg = security_group_template() @@ -557,9 +554,6 @@ class TestSecurityGroupRules(test.TestCase): self.controller = security_groups.SecurityGroupRulesController() - def tearDown(self): - super(TestSecurityGroupRules, self).tearDown() - def test_create_by_cidr(self): rule = security_group_rule_template(cidr='10.2.3.124/24') diff --git a/nova/tests/api/openstack/compute/contrib/test_server_start_stop.py b/nova/tests/api/openstack/compute/contrib/test_server_start_stop.py index a196d6520..ba8930356 100644 --- a/nova/tests/api/openstack/compute/contrib/test_server_start_stop.py +++ b/nova/tests/api/openstack/compute/contrib/test_server_start_stop.py @@ -33,9 +33,6 @@ class ServerStartStopTest(test.TestCase): super(ServerStartStopTest, self).setUp() self.controller = server_start_stop.ServerStartStopActionController() - def tearDown(self): - super(ServerStartStopTest, self).tearDown() - def test_start(self): self.stubs.Set(compute.API, 'get', fake_compute_api_get) self.mox.StubOutWithMock(compute.API, 'start') diff --git a/nova/tests/api/openstack/compute/contrib/test_virtual_interfaces.py b/nova/tests/api/openstack/compute/contrib/test_virtual_interfaces.py index a5a76f98e..16f946bfc 100644 --- a/nova/tests/api/openstack/compute/contrib/test_virtual_interfaces.py +++ b/nova/tests/api/openstack/compute/contrib/test_virtual_interfaces.py @@ -49,9 +49,6 @@ class ServerVirtualInterfaceTest(test.TestCase): self.stubs.Set(network.api.API, "get_vifs_by_instance", get_vifs_by_instance) - def tearDown(self): - super(ServerVirtualInterfaceTest, self).tearDown() - def test_get_virtual_interfaces_list(self): url = '/v2/fake/servers/abcd/os-virtual-interfaces' req = webob.Request.blank(url) diff --git a/nova/tests/api/openstack/compute/contrib/test_volumes.py b/nova/tests/api/openstack/compute/contrib/test_volumes.py index 7a29cff36..14af207a7 100644 --- a/nova/tests/api/openstack/compute/contrib/test_volumes.py +++ b/nova/tests/api/openstack/compute/contrib/test_volumes.py @@ -115,9 +115,6 @@ class VolumeApiTest(test.TestCase): self.context = context.get_admin_context() self.test_obj = test_obj if test_obj else "volume" - def tearDown(self): - super(VolumeApiTest, self).tearDown() - def test_volume_create(self): self.stubs.Set(volume.api.API, "create", fakes.stub_volume_create) diff --git a/nova/tests/api/openstack/compute/contrib/test_vsa.py b/nova/tests/api/openstack/compute/contrib/test_vsa.py index c04a3636d..049977d42 100644 --- a/nova/tests/api/openstack/compute/contrib/test_vsa.py +++ b/nova/tests/api/openstack/compute/contrib/test_vsa.py @@ -104,9 +104,6 @@ class VSAApiTest(test.TestCase): self.stubs.Set(vsa.api.API, "get", stub_vsa_get) self.stubs.Set(vsa.api.API, "get_all", stub_vsa_get_all) - def tearDown(self): - super(VSAApiTest, self).tearDown() - def test_vsa_create(self): global last_param last_param = {} @@ -253,9 +250,6 @@ class VSAVolumeApiTest(test.TestCase): self.test_obj = test_obj if test_obj else "volume" self.test_objs = test_objs if test_objs else "volumes" - def tearDown(self): - super(VSAVolumeApiTest, self).tearDown() - def test_vsa_volume_create(self): self.stubs.Set(volume.api.API, "create", fakes.stub_volume_create) diff --git a/nova/tests/api/openstack/compute/test_limits.py b/nova/tests/api/openstack/compute/test_limits.py index 0dfd4d387..a743903df 100644 --- a/nova/tests/api/openstack/compute/test_limits.py +++ b/nova/tests/api/openstack/compute/test_limits.py @@ -788,6 +788,7 @@ class WsgiLimiterProxyTest(BaseLimitTestSuite): class LimitsViewBuilderTest(test.TestCase): def setUp(self): + super(LimitsViewBuilderTest, self).setUp() self.view_builder = views.limits.ViewBuilder() self.rate_limits = [{"URI": "*", "regex": ".*", @@ -807,9 +808,6 @@ class LimitsViewBuilderTest(test.TestCase): "injected_files": 5, "injected_file_content_bytes": 5} - def tearDown(self): - pass - def test_build_limits(self): expected_limits = {"limits": { "rate": [{ @@ -847,7 +845,6 @@ class LimitsViewBuilderTest(test.TestCase): class LimitsXMLSerializationTest(test.TestCase): - def test_xml_declaration(self): serializer = limits.LimitsTemplate() diff --git a/nova/tests/api/openstack/compute/test_server_actions.py b/nova/tests/api/openstack/compute/test_server_actions.py index f37020619..30c3d8cff 100644 --- a/nova/tests/api/openstack/compute/test_server_actions.py +++ b/nova/tests/api/openstack/compute/test_server_actions.py @@ -658,11 +658,9 @@ class ServerActionsControllerTest(test.TestCase): class TestServerActionXMLDeserializer(test.TestCase): def setUp(self): + super(TestServerActionXMLDeserializer, self).setUp() self.deserializer = servers.ActionDeserializer() - def tearDown(self): - pass - def test_create_image(self): serial_request = """