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:
@@ -29,13 +29,6 @@ FLAGS = flags.FLAGS
|
|||||||
|
|
||||||
|
|
||||||
class SchedulerRpcAPITestCase(test.TestCase):
|
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):
|
def _test_scheduler_api(self, method, rpc_method, **kwargs):
|
||||||
ctxt = context.RequestContext('fake_user', 'fake_project')
|
ctxt = context.RequestContext('fake_user', 'fake_project')
|
||||||
rpcapi = scheduler_rpcapi.SchedulerAPI()
|
rpcapi = scheduler_rpcapi.SchedulerAPI()
|
||||||
|
|||||||
@@ -28,10 +28,6 @@ FLAGS.register_opt(cfg.StrOpt('flags_unittest',
|
|||||||
|
|
||||||
|
|
||||||
class FlagsTestCase(test.TestCase):
|
class FlagsTestCase(test.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
super(FlagsTestCase, self).setUp()
|
|
||||||
|
|
||||||
def test_declare(self):
|
def test_declare(self):
|
||||||
self.assert_('answer' not in FLAGS)
|
self.assert_('answer' not in FLAGS)
|
||||||
flags.DECLARE('answer', 'nova.tests.declare_flags')
|
flags.DECLARE('answer', 'nova.tests.declare_flags')
|
||||||
|
|||||||
@@ -3912,9 +3912,6 @@ class LibvirtNonblockingTestCase(test.TestCase):
|
|||||||
super(LibvirtNonblockingTestCase, self).setUp()
|
super(LibvirtNonblockingTestCase, self).setUp()
|
||||||
self.flags(libvirt_nonblocking=True, libvirt_uri="test:///default")
|
self.flags(libvirt_nonblocking=True, libvirt_uri="test:///default")
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
super(LibvirtNonblockingTestCase, self).tearDown()
|
|
||||||
|
|
||||||
def test_connection_to_primitive(self):
|
def test_connection_to_primitive(self):
|
||||||
"""Test bug 962840"""
|
"""Test bug 962840"""
|
||||||
import nova.virt.libvirt.driver as libvirt_driver
|
import nova.virt.libvirt.driver as libvirt_driver
|
||||||
|
|||||||
@@ -48,9 +48,6 @@ class TestNexentaDriver(nova.test.TestCase):
|
|||||||
'volume_name': TEST_VOLUME_NAME,
|
'volume_name': TEST_VOLUME_NAME,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, method):
|
|
||||||
super(TestNexentaDriver, self).__init__(method)
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestNexentaDriver, self).setUp()
|
super(TestNexentaDriver, self).setUp()
|
||||||
self.flags(
|
self.flags(
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class SolidFireVolumeTestCase(test.TestCase):
|
class SolidFireVolumeTestCase(test.TestCase):
|
||||||
def setUp(self):
|
|
||||||
super(SolidFireVolumeTestCase, self).setUp()
|
|
||||||
|
|
||||||
def fake_issue_api_request(obj, method, params):
|
def fake_issue_api_request(obj, method, params):
|
||||||
if method is 'GetClusterInfo':
|
if method is 'GetClusterInfo':
|
||||||
LOG.info('Called Fake GetClusterInfo...')
|
LOG.info('Called Fake GetClusterInfo...')
|
||||||
|
|||||||
@@ -889,9 +889,6 @@ class StorwizeSVCManagementSimulator:
|
|||||||
|
|
||||||
|
|
||||||
class StorwizeSVCFakeDriver(storwize_svc.StorwizeSVCDriver):
|
class StorwizeSVCFakeDriver(storwize_svc.StorwizeSVCDriver):
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super(StorwizeSVCFakeDriver, self).__init__(*args, **kwargs)
|
|
||||||
|
|
||||||
def set_fake_storage(self, fake):
|
def set_fake_storage(self, fake):
|
||||||
self.fake_storage = fake
|
self.fake_storage = fake
|
||||||
|
|
||||||
|
|||||||
@@ -554,9 +554,6 @@ class LibvirtConnTestCase(_VirtDriverTestCase):
|
|||||||
self.driver_module = 'nova.virt.libvirt.LibvirtDriver'
|
self.driver_module = 'nova.virt.libvirt.LibvirtDriver'
|
||||||
super(LibvirtConnTestCase, self).setUp()
|
super(LibvirtConnTestCase, self).setUp()
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
super(LibvirtConnTestCase, self).tearDown()
|
|
||||||
|
|
||||||
def test_force_hard_reboot(self):
|
def test_force_hard_reboot(self):
|
||||||
self.flags(libvirt_wait_soft_reboot_seconds=0)
|
self.flags(libvirt_wait_soft_reboot_seconds=0)
|
||||||
self.test_reboot()
|
self.test_reboot()
|
||||||
|
|||||||
@@ -164,9 +164,6 @@ class FakeSessionForVMTests(fake.SessionBase):
|
|||||||
"COMMIT\n"
|
"COMMIT\n"
|
||||||
"# Completed on Sun Nov 6 22:49:02 2011\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):
|
def host_call_plugin(self, _1, _2, plugin, method, _5):
|
||||||
if (plugin, method) == ('glance', 'download_vhd'):
|
if (plugin, method) == ('glance', 'download_vhd'):
|
||||||
root_uuid = _make_fake_vdi()
|
root_uuid = _make_fake_vdi()
|
||||||
@@ -286,9 +283,6 @@ def stub_out_vm_methods(stubs):
|
|||||||
|
|
||||||
class FakeSessionForVolumeTests(fake.SessionBase):
|
class FakeSessionForVolumeTests(fake.SessionBase):
|
||||||
""" Stubs out a XenAPISession for Volume tests """
|
""" 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,
|
def VDI_introduce(self, _1, uuid, _2, _3, _4, _5,
|
||||||
_6, _7, _8, _9, _10, _11):
|
_6, _7, _8, _9, _10, _11):
|
||||||
valid_vdi = False
|
valid_vdi = False
|
||||||
@@ -303,9 +297,6 @@ class FakeSessionForVolumeTests(fake.SessionBase):
|
|||||||
|
|
||||||
class FakeSessionForVolumeFailedTests(FakeSessionForVolumeTests):
|
class FakeSessionForVolumeFailedTests(FakeSessionForVolumeTests):
|
||||||
""" Stubs out a XenAPISession for Volume tests: it injects failures """
|
""" 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,
|
def VDI_introduce(self, _1, uuid, _2, _3, _4, _5,
|
||||||
_6, _7, _8, _9, _10, _11):
|
_6, _7, _8, _9, _10, _11):
|
||||||
# This is for testing failure
|
# This is for testing failure
|
||||||
@@ -358,9 +349,6 @@ def stub_out_migration_methods(stubs):
|
|||||||
|
|
||||||
|
|
||||||
class FakeSessionForFailedMigrateTests(FakeSessionForVMTests):
|
class FakeSessionForFailedMigrateTests(FakeSessionForVMTests):
|
||||||
def __init__(self, uri):
|
|
||||||
super(FakeSessionForFailedMigrateTests, self).__init__(uri)
|
|
||||||
|
|
||||||
def VM_assert_can_migrate(self, session, vmref, migrate_data,
|
def VM_assert_can_migrate(self, session, vmref, migrate_data,
|
||||||
live, vdi_map, vif_map, options):
|
live, vdi_map, vif_map, options):
|
||||||
raise fake.Failure("XenAPI VM.assert_can_migrate failed")
|
raise fake.Failure("XenAPI VM.assert_can_migrate failed")
|
||||||
|
|||||||
@@ -14,9 +14,6 @@ class GetInstanceForVdisForSrTestCase(stubs.XenAPITestBase):
|
|||||||
xenapi_connection_url='test_url',
|
xenapi_connection_url='test_url',
|
||||||
xenapi_connection_password='test_pass',)
|
xenapi_connection_password='test_pass',)
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
super(GetInstanceForVdisForSrTestCase, self).tearDown()
|
|
||||||
|
|
||||||
def test_get_instance_vdis_for_sr(self):
|
def test_get_instance_vdis_for_sr(self):
|
||||||
vm_ref = fake.create_vm("foo", "Running")
|
vm_ref = fake.create_vm("foo", "Running")
|
||||||
sr_ref = fake.create_sr()
|
sr_ref = fake.create_sr()
|
||||||
|
|||||||
Reference in New Issue
Block a user