Remove unnecessary setUp, tearDown and __init__ in tests

These methods simply call the same parent class method with the same
arguments. This is the default behavior of Python and re-implementing
that is unnecessary.

Change-Id: I29503f6c5442e2aae645899dc157466e6201ba75
This commit is contained in:
Johannes Erdfelt
2012-09-28 21:48:30 +00:00
parent 84e484f65a
commit 88db6fe69a
9 changed files with 0 additions and 41 deletions

View File

@@ -29,13 +29,6 @@ FLAGS = flags.FLAGS
class SchedulerRpcAPITestCase(test.TestCase):
def setUp(self):
super(SchedulerRpcAPITestCase, self).setUp()
def tearDown(self):
super(SchedulerRpcAPITestCase, self).tearDown()
def _test_scheduler_api(self, method, rpc_method, **kwargs):
ctxt = context.RequestContext('fake_user', 'fake_project')
rpcapi = scheduler_rpcapi.SchedulerAPI()

View File

@@ -28,10 +28,6 @@ FLAGS.register_opt(cfg.StrOpt('flags_unittest',
class FlagsTestCase(test.TestCase):
def setUp(self):
super(FlagsTestCase, self).setUp()
def test_declare(self):
self.assert_('answer' not in FLAGS)
flags.DECLARE('answer', 'nova.tests.declare_flags')

View File

@@ -3912,9 +3912,6 @@ class LibvirtNonblockingTestCase(test.TestCase):
super(LibvirtNonblockingTestCase, self).setUp()
self.flags(libvirt_nonblocking=True, libvirt_uri="test:///default")
def tearDown(self):
super(LibvirtNonblockingTestCase, self).tearDown()
def test_connection_to_primitive(self):
"""Test bug 962840"""
import nova.virt.libvirt.driver as libvirt_driver

View File

@@ -48,9 +48,6 @@ class TestNexentaDriver(nova.test.TestCase):
'volume_name': TEST_VOLUME_NAME,
}
def __init__(self, method):
super(TestNexentaDriver, self).__init__(method)
def setUp(self):
super(TestNexentaDriver, self).setUp()
self.flags(

View File

@@ -24,9 +24,6 @@ LOG = logging.getLogger(__name__)
class SolidFireVolumeTestCase(test.TestCase):
def setUp(self):
super(SolidFireVolumeTestCase, self).setUp()
def fake_issue_api_request(obj, method, params):
if method is 'GetClusterInfo':
LOG.info('Called Fake GetClusterInfo...')

View File

@@ -889,9 +889,6 @@ class StorwizeSVCManagementSimulator:
class StorwizeSVCFakeDriver(storwize_svc.StorwizeSVCDriver):
def __init__(self, *args, **kwargs):
super(StorwizeSVCFakeDriver, self).__init__(*args, **kwargs)
def set_fake_storage(self, fake):
self.fake_storage = fake

View File

@@ -554,9 +554,6 @@ class LibvirtConnTestCase(_VirtDriverTestCase):
self.driver_module = 'nova.virt.libvirt.LibvirtDriver'
super(LibvirtConnTestCase, self).setUp()
def tearDown(self):
super(LibvirtConnTestCase, self).tearDown()
def test_force_hard_reboot(self):
self.flags(libvirt_wait_soft_reboot_seconds=0)
self.test_reboot()

View File

@@ -164,9 +164,6 @@ class FakeSessionForVMTests(fake.SessionBase):
"COMMIT\n"
"# Completed on Sun Nov 6 22:49:02 2011\n")
def __init__(self, uri):
super(FakeSessionForVMTests, self).__init__(uri)
def host_call_plugin(self, _1, _2, plugin, method, _5):
if (plugin, method) == ('glance', 'download_vhd'):
root_uuid = _make_fake_vdi()
@@ -286,9 +283,6 @@ def stub_out_vm_methods(stubs):
class FakeSessionForVolumeTests(fake.SessionBase):
""" Stubs out a XenAPISession for Volume tests """
def __init__(self, uri):
super(FakeSessionForVolumeTests, self).__init__(uri)
def VDI_introduce(self, _1, uuid, _2, _3, _4, _5,
_6, _7, _8, _9, _10, _11):
valid_vdi = False
@@ -303,9 +297,6 @@ class FakeSessionForVolumeTests(fake.SessionBase):
class FakeSessionForVolumeFailedTests(FakeSessionForVolumeTests):
""" Stubs out a XenAPISession for Volume tests: it injects failures """
def __init__(self, uri):
super(FakeSessionForVolumeFailedTests, self).__init__(uri)
def VDI_introduce(self, _1, uuid, _2, _3, _4, _5,
_6, _7, _8, _9, _10, _11):
# This is for testing failure
@@ -358,9 +349,6 @@ def stub_out_migration_methods(stubs):
class FakeSessionForFailedMigrateTests(FakeSessionForVMTests):
def __init__(self, uri):
super(FakeSessionForFailedMigrateTests, self).__init__(uri)
def VM_assert_can_migrate(self, session, vmref, migrate_data,
live, vdi_map, vif_map, options):
raise fake.Failure("XenAPI VM.assert_can_migrate failed")

View File

@@ -14,9 +14,6 @@ class GetInstanceForVdisForSrTestCase(stubs.XenAPITestBase):
xenapi_connection_url='test_url',
xenapi_connection_password='test_pass',)
def tearDown(self):
super(GetInstanceForVdisForSrTestCase, self).tearDown()
def test_get_instance_vdis_for_sr(self):
vm_ref = fake.create_vm("foo", "Running")
sr_ref = fake.create_sr()