Remove unnecessary setUp and tearDown

setUp and tearDown will be automatically called around each
testcase, so this is to remove setUp and tearDown that doing
nothing additional than super to keep code clean.

Change-Id: I80ae55cc36c473e8ed7fc7f4cbd946107bf187b4
This commit is contained in:
zhufl 2016-09-20 11:45:04 +08:00
parent 205a850276
commit 8849b3b226
27 changed files with 0 additions and 93 deletions

View File

@ -163,9 +163,6 @@ class QuotaSetsControllerTestBase(test.TestCase):
class QuotaSetsControllerTest(QuotaSetsControllerTestBase):
def setUp(self):
super(QuotaSetsControllerTest, self).setUp()
def test_defaults(self):
result = self.controller.defaults(self.req, fake.PROJECT_ID)
self.assertDictMatch(make_body(), result)

View File

@ -144,9 +144,6 @@ class VolumeTypesManageApiTest(test.TestCase):
self.controller = types_manage.VolumeTypesManageController()
"""to reset notifier drivers left over from other api/contrib tests"""
def tearDown(self):
super(VolumeTypesManageApiTest, self).tearDown()
def test_volume_types_delete(self):
self.stubs.Set(volume_types, 'get_volume_type',
return_volume_types_get_volume_type)

View File

@ -23,9 +23,6 @@ from cinder import test
class ChanceWeigherTestCase(test.TestCase):
def setUp(self):
super(ChanceWeigherTestCase, self).setUp()
def fake_random(self, reset=False):
if reset:
self.not_random_float = 0.0

View File

@ -21,9 +21,6 @@ from cinder.tests.unit.scheduler import fakes
class GoodnessWeigherTestCase(test.TestCase):
def setUp(self):
super(GoodnessWeigherTestCase, self).setUp()
def test_goodness_weigher_with_no_goodness_function(self):
weigher = goodness.GoodnessWeigher()
host_state = fakes.FakeHostState('host1', {

View File

@ -39,9 +39,6 @@ class SchedulerRpcAPITestCase(test.TestCase):
self.context = context.RequestContext('fake_user', 'fake_project')
self.volume_id = fake_constants.VOLUME_ID
def tearDown(self):
super(SchedulerRpcAPITestCase, self).tearDown()
def _test_scheduler_api(self, method, rpc_method,
fanout=False, **kwargs):
ctxt = self.context

View File

@ -386,9 +386,6 @@ class TestCinderManageCmd(test.TestCase):
super(TestCinderManageCmd, self).setUp()
sys.argv = ['cinder-manage']
def tearDown(self):
super(TestCinderManageCmd, self).tearDown()
def _test_purge_invalid_age_in_days(self, age_in_days):
db_cmds = cinder_manage.DbCommands()
ex = self.assertRaises(SystemExit, db_cmds.purge, age_in_days)

View File

@ -224,9 +224,6 @@ class TestFSSISCSIDriver(FSSDriverTestCase):
self.mock_utils = mock.Mock()
self.driver.driver_utils = self.mock_utils
def tearDown(self):
super(TestFSSISCSIDriver, self).tearDown()
def test_initialized_should_set_fss_info(self):
self.assertEqual(self.driver.proxy.fss_host,
self.driver.configuration.san_ip)
@ -526,9 +523,6 @@ class TestRESTProxy(test.TestCase):
self.FSS_MOCK._fss_request.return_value = API_RESPONSE
self.stubs.Set(time, 'sleep', Fake_sleep)
def tearDown(self):
super(TestRESTProxy, self).tearDown()
def test_do_setup(self):
self.proxy.do_setup()
self.FSS_MOCK.fss_login.assert_called_once_with()

View File

@ -171,9 +171,6 @@ class SynoSessionTestCase(test.TestCase):
self.device_id)
self.session.__class__.__del__ = lambda x: x
def tearDown(self):
super(SynoSessionTestCase, self).tearDown()
def test_query(self):
out = {
'maxVersion': 3,
@ -350,9 +347,6 @@ class SynoCommonTestCase(test.TestCase):
self.common.volume_backend_name = 'DiskStation'
self.common.iscsi_port = 3260
def tearDown(self):
super(SynoCommonTestCase, self).tearDown()
def setup_configuration(self):
config = mock.Mock(spec=conf.Configuration)
config.use_chap_auth = False

View File

@ -91,9 +91,6 @@ class SynoISCSIDriverTestCase(test.TestCase):
self.driver = synology_iscsi.SynoISCSIDriver(configuration=self.conf)
self.driver.common = common.SynoCommon(self.conf, 'iscsi')
def tearDown(self):
super(SynoISCSIDriverTestCase, self).tearDown()
def setup_configuration(self):
config = mock.Mock(spec=conf.Configuration)
config.use_chap_auth = False

View File

@ -953,9 +953,6 @@ class WrongException(Exception):
class TestRetryDecorator(test.TestCase):
def setUp(self):
super(TestRetryDecorator, self).setUp()
def test_no_retry_required(self):
self.counter = 0

View File

@ -145,9 +145,6 @@ class V7000ISCSIDriverTestCase(test.TestCase):
self.stats = {}
self.driver.set_initialized()
def tearDown(self):
super(V7000ISCSIDriverTestCase, self).tearDown()
def setup_configuration(self):
config = mock.Mock(spec=conf.Configuration)
config.volume_backend_name = 'v7000_iscsi'

View File

@ -355,9 +355,6 @@ class ZteISCSIDriverTestCase(ZteBaseDriverTestCase, test.TestCase):
self.driver = FakeZteISCSIDriver(configuration=self.configuration)
self.driver.do_setup({})
def tearDown(self):
super(ZteISCSIDriverTestCase, self).tearDown()
def test_get_volume_stats(self):
stats = self.driver.get_volume_stats(True)
self.assertEqual("ZTE", stats["vendor_name"])

View File

@ -20,12 +20,6 @@ from cinder.volume.drivers.emc.vnx import utils
class TestResMock(test.TestCase):
def setUp(self):
super(TestResMock, self).setUp()
def tearDown(self):
super(TestResMock, self).tearDown()
def test_load_cinder_resource(self):
cinder_res = res_mock.CinderResourceMock('mocked_cinder.yaml')

View File

@ -2020,9 +2020,6 @@ class InfortrendCLITestCase(test.TestCase):
super(InfortrendCLITestCase, self).__init__(*args, **kwargs)
self.cli_data = InfortrendCLITestData()
def setUp(self):
super(InfortrendCLITestCase, self).setUp()
def _cli_set(self, cli, fake_result):
cli_conf = {
'path': '',

View File

@ -245,9 +245,6 @@ class NetAppApiServerTests(test.TestCase):
class NetAppApiElementTransTests(test.TestCase):
"""Test case for NetApp API element translations."""
def setUp(self):
super(NetAppApiElementTransTests, self).setUp()
def test_translate_struct_dict_unique_key(self):
"""Tests if dict gets properly converted to NaElements."""
root = netapp_api.NaElement('root')

View File

@ -61,9 +61,6 @@ class NetApp7modeClientTestCase(test.TestCase):
self.connection = self.client.connection
self.fake_lun = six.text_type(uuid.uuid4())
def tearDown(self):
super(NetApp7modeClientTestCase, self).tearDown()
def test_get_iscsi_target_details_no_targets(self):
response = netapp_api.NaElement(
etree.XML("""<results status="passed">

View File

@ -54,9 +54,6 @@ class NetAppBaseClientTestCase(test.TestCase):
self.fake_metadata = {'OsType': 'linux', 'SpaceReserved': 'true'}
self.mock_send_request = self.mock_object(self.client, 'send_request')
def tearDown(self):
super(NetAppBaseClientTestCase, self).tearDown()
def test_get_ontapi_version(self):
version_response = netapp_api.NaElement(
etree.XML("""<results status="passed">

View File

@ -66,9 +66,6 @@ class NetAppCmodeClientTestCase(test.TestCase):
self.fake_lun = six.text_type(uuid.uuid4())
self.mock_send_request = self.mock_object(self.client, 'send_request')
def tearDown(self):
super(NetAppCmodeClientTestCase, self).tearDown()
def _mock_api_error(self, code='fake'):
return mock.Mock(side_effect=netapp_api.NaApiError(code=code))

View File

@ -61,9 +61,6 @@ class NetAppBlockStorage7modeLibraryTestCase(test.TestCase):
# Deprecated option
self.library.configuration.netapp_volume_list = None
def tearDown(self):
super(NetAppBlockStorage7modeLibraryTestCase, self).tearDown()
def get_config_7mode(self):
config = na_fakes.create_configuration_7mode()
config.netapp_storage_protocol = 'iscsi'

View File

@ -59,9 +59,6 @@ class NetAppBlockStorageLibraryTestCase(test.TestCase):
self.zapi_client = self.library.zapi_client
self.mock_request = mock.Mock()
def tearDown(self):
super(NetAppBlockStorageLibraryTestCase, self).tearDown()
def get_config_base(self):
return na_fakes.create_configuration()

View File

@ -68,9 +68,6 @@ class NetAppBlockStorageCmodeLibraryTestCase(test.TestCase):
}
self.mock_object(block_base.NetAppBlockStorageLibrary, 'delete_volume')
def tearDown(self):
super(NetAppBlockStorageCmodeLibraryTestCase, self).tearDown()
def get_config_cmode(self):
config = na_fakes.create_configuration_cmode()
config.netapp_storage_protocol = 'iscsi'

View File

@ -541,9 +541,6 @@ class OpenStackInfoTestCase(test.TestCase):
DEB_RLS = 'upstream_version-debian_revision'
DEB_VENDOR = 'debian_revision'
def setUp(self):
super(OpenStackInfoTestCase, self).setUp()
def test_openstack_info_init(self):
info = na_utils.OpenStackInfo()
@ -818,9 +815,6 @@ class FeaturesTestCase(test.TestCase):
@ddt.ddt
class BitSetTestCase(test.TestCase):
def setUp(self):
super(BitSetTestCase, self).setUp()
def test_default(self):
self.assertEqual(na_utils.BitSet(0), na_utils.BitSet())

View File

@ -653,9 +653,6 @@ class DrbdManageDrbdTestCase(DrbdManageIscsiTestCase):
class DrbdManageCommonTestCase(DrbdManageIscsiTestCase):
def setUp(self):
super(DrbdManageCommonTestCase, self).setUp()
def test_drbd_policy_loop_timeout(self):
dmd = drv.DrbdManageDrbdDriver(configuration=self.configuration)
dmd.odm = DrbdManageFakeDriver()

View File

@ -511,9 +511,6 @@ class PureBaseSharedDriverTestCase(PureDriverTestCase):
@ddt.ddt
class PureBaseVolumeDriverTestCase(PureBaseSharedDriverTestCase):
def setUp(self):
super(PureBaseVolumeDriverTestCase, self).setUp()
def _setup_mocks_for_replication(self):
# Mock config values
self.mock_config.pure_replica_interval_default = (

View File

@ -533,9 +533,6 @@ class TestZFSSAISCSIDriver(test.TestCase):
self.assertEqual(self.configuration.zfssa_lun_logbias,
ret.get('logbias'))
def tearDown(self):
super(TestZFSSAISCSIDriver, self).tearDown()
def fake_safe_get(self, value):
try:
val = getattr(self.configuration, value)

View File

@ -394,9 +394,6 @@ class V7000CommonTestCase(test.TestCase):
self.driver.device_id = 'ata-VIOLIN_MEMORY_ARRAY_23109R00000022'
self.stats = {}
def tearDown(self):
super(V7000CommonTestCase, self).tearDown()
def setup_configuration(self):
config = mock.Mock(spec=conf.Configuration)
config.volume_backend_name = 'v7000_common'

View File

@ -222,9 +222,6 @@ class V7000FCPDriverTestCase(test.TestCase):
self.stats = {}
self.driver.set_initialized()
def tearDown(self):
super(V7000FCPDriverTestCase, self).tearDown()
def setup_configuration(self):
config = mock.Mock(spec=conf.Configuration)
config.volume_backend_name = 'v7000_fcp'