From 98255e67152cb2d80f803d74cc78b82e109fe8a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Antal?= Date: Wed, 2 Aug 2017 13:38:43 +0200 Subject: [PATCH] Removed unnecessary setUp() calls in tests Basically, if you decide to override a method, that is because you want to specify(or modify) the behavior of a method. If you just call the inherited method from the overridden method, that is unnecessary. Furthermore, every time when self.setUp() is called, now the super's setUp() is called, which is basically exact the same behavior as we have now. TrivialFix Change-Id: I9f4e03b93ff075c66b4e52342711c37f226d2f81 --- manila/tests/db/sqlalchemy/test_models.py | 3 --- manila/tests/scheduler/test_rpcapi.py | 3 --- manila/tests/scheduler/test_utils.py | 3 --- manila/tests/share/drivers/hpe/test_hpe_3par_driver.py | 3 --- manila/tests/share/drivers/netapp/test_common.py | 3 --- manila/tests/share/drivers/netapp/test_utils.py | 3 --- manila/tests/test_conf.py | 3 --- manila/tests/test_rpc.py | 3 --- manila/tests/test_utils.py | 3 --- 9 files changed, 27 deletions(-) diff --git a/manila/tests/db/sqlalchemy/test_models.py b/manila/tests/db/sqlalchemy/test_models.py index 06b456dac0..e3a126c44c 100644 --- a/manila/tests/db/sqlalchemy/test_models.py +++ b/manila/tests/db/sqlalchemy/test_models.py @@ -27,9 +27,6 @@ from manila.tests import db_utils class ShareTestCase(test.TestCase): """Testing of SQLAlchemy Share model class.""" - def setUp(self): - super(ShareTestCase, self).setUp() - @ddt.data(constants.STATUS_MANAGE_ERROR, constants.STATUS_CREATING, constants.STATUS_EXTENDING, constants.STATUS_DELETING, constants.STATUS_EXTENDING_ERROR, diff --git a/manila/tests/scheduler/test_rpcapi.py b/manila/tests/scheduler/test_rpcapi.py index d0e8abc147..96e772efe4 100644 --- a/manila/tests/scheduler/test_rpcapi.py +++ b/manila/tests/scheduler/test_rpcapi.py @@ -30,9 +30,6 @@ CONF = cfg.CONF class SchedulerRpcAPITestCase(test.TestCase): - def setUp(self): - super(SchedulerRpcAPITestCase, self).setUp() - def tearDown(self): super(SchedulerRpcAPITestCase, self).tearDown() diff --git a/manila/tests/scheduler/test_utils.py b/manila/tests/scheduler/test_utils.py index 4dcf451059..d94a157424 100644 --- a/manila/tests/scheduler/test_utils.py +++ b/manila/tests/scheduler/test_utils.py @@ -27,9 +27,6 @@ from manila import test class UtilsTestCase(test.TestCase): """Test case for utils.""" - def setUp(self): - super(UtilsTestCase, self).setUp() - @ddt.data( ({'extra_specs': {'thin_provisioning': True}}, True), ({'extra_specs': {'thin_provisioning': False}}, False), diff --git a/manila/tests/share/drivers/hpe/test_hpe_3par_driver.py b/manila/tests/share/drivers/hpe/test_hpe_3par_driver.py index bad6971f44..16f2a187b3 100644 --- a/manila/tests/share/drivers/hpe/test_hpe_3par_driver.py +++ b/manila/tests/share/drivers/hpe/test_hpe_3par_driver.py @@ -30,9 +30,6 @@ from manila.tests.share.drivers.hpe import test_hpe_3par_constants as constants @ddt.ddt class HPE3ParDriverFPGTestCase(test.TestCase): - def setUp(self): - super(HPE3ParDriverFPGTestCase, self).setUp() - @ddt.data((-1, 4), (0, 5), (0, -1)) diff --git a/manila/tests/share/drivers/netapp/test_common.py b/manila/tests/share/drivers/netapp/test_common.py index 2008ac78eb..8f9a4fc25f 100644 --- a/manila/tests/share/drivers/netapp/test_common.py +++ b/manila/tests/share/drivers/netapp/test_common.py @@ -25,9 +25,6 @@ from manila.tests.share.drivers.netapp import fakes as na_fakes class NetAppDriverFactoryTestCase(test.TestCase): - def setUp(self): - super(NetAppDriverFactoryTestCase, self).setUp() - def test_new(self): self.mock_object(na_utils.OpenStackInfo, 'info', diff --git a/manila/tests/share/drivers/netapp/test_utils.py b/manila/tests/share/drivers/netapp/test_utils.py index 5579be7a62..6dcc1f8e0d 100644 --- a/manila/tests/share/drivers/netapp/test_utils.py +++ b/manila/tests/share/drivers/netapp/test_utils.py @@ -162,9 +162,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() diff --git a/manila/tests/test_conf.py b/manila/tests/test_conf.py index 2c9e897a0f..7e6f224804 100644 --- a/manila/tests/test_conf.py +++ b/manila/tests/test_conf.py @@ -28,9 +28,6 @@ CONF.register_opt(cfg.StrOpt('conf_unittest', class ConfigTestCase(test.TestCase): - def setUp(self): - super(ConfigTestCase, self).setUp() - def test_declare(self): self.assertNotIn('answer', CONF) CONF.import_opt('answer', 'manila.tests.declare_conf') diff --git a/manila/tests/test_rpc.py b/manila/tests/test_rpc.py index 9cd5d0d3d6..1f3b3ea612 100644 --- a/manila/tests/test_rpc.py +++ b/manila/tests/test_rpc.py @@ -21,9 +21,6 @@ from manila import test @ddt.ddt class RPCTestCase(test.TestCase): - def setUp(self): - super(RPCTestCase, self).setUp() - @ddt.data([], ['noop'], ['noop', 'noop']) @mock.patch('oslo_messaging.JsonPayloadSerializer', wraps=True) def test_init_no_notifications(self, driver, serializer_mock): diff --git a/manila/tests/test_utils.py b/manila/tests/test_utils.py index 31e6217b7f..7b0e5e22e5 100644 --- a/manila/tests/test_utils.py +++ b/manila/tests/test_utils.py @@ -525,9 +525,6 @@ class TestComparableMixin(test.TestCase): class TestRetryDecorator(test.TestCase): - def setUp(self): - super(TestRetryDecorator, self).setUp() - def test_no_retry_required(self): self.counter = 0