From fd23a6387c92b288a4a5f64a3e0190895e14f85f Mon Sep 17 00:00:00 2001 From: Goutham Pacha Ravi Date: Wed, 6 Jun 2018 16:50:44 -0700 Subject: [PATCH] Use class name in invocation of super Fix pylint E103 warning raised by usage of self.__class__ to refer to the derived class in super() methods. self.__class__ is a reasonable first argument to super() in any method of a class, as long as the method is not going to be invoked in derived classes. Python3 removes this ambiguity by not requiring arguments for the super() method. [1] https://docs.pylint.org/en/1.6.0/features.html#id33 Change-Id: I6071b6cfd8cff2be3853d739f71b94da990cda97 --- manila/api/v1/share_manage.py | 2 +- manila/api/v1/share_unmanage.py | 2 +- manila/api/v1/shares.py | 2 +- manila/api/v2/share_export_locations.py | 2 +- .../api/v2/share_instance_export_locations.py | 2 +- manila/api/v2/share_instances.py | 2 +- .../api/v2/share_snapshot_export_locations.py | 2 +- ...hare_snapshot_instance_export_locations.py | 2 +- manila/api/v2/share_snapshot_instances.py | 2 +- manila/api/v2/share_types.py | 2 +- manila/api/v2/shares.py | 2 +- manila/scheduler/manager.py | 2 +- manila/share/drivers/hitachi/hsp/driver.py | 2 +- manila/share/drivers/qnap/qnap.py | 2 +- manila/share/drivers/zfsonlinux/driver.py | 6 ++--- manila/tests/api/v1/test_share_snapshots.py | 4 ++-- manila/tests/api/v1/test_shares.py | 6 ++--- manila/tests/api/v2/test_quota_class_sets.py | 2 +- manila/tests/api/v2/test_quota_sets.py | 2 +- manila/tests/api/v2/test_services.py | 2 +- .../api/v2/test_share_export_locations.py | 2 +- .../api/v2/test_share_group_snapshots.py | 2 +- manila/tests/api/v2/test_share_group_types.py | 4 ++-- manila/tests/api/v2/test_share_groups.py | 2 +- .../test_share_instance_export_locations.py | 2 +- manila/tests/api/v2/test_share_instances.py | 2 +- manila/tests/api/v2/test_share_snapshots.py | 4 ++-- manila/tests/api/v2/test_share_types.py | 4 ++-- manila/tests/api/v2/test_shares.py | 10 ++++----- manila/tests/db/sqlalchemy/test_api.py | 7 +++--- manila/tests/scheduler/test_manager.py | 3 +-- .../plugins/vmax/test_object_manager.py | 22 +++++++++---------- .../plugins/vnx/test_object_manager.py | 22 +++++++++---------- manila/tests/share/drivers/dummy.py | 4 ++-- .../share/drivers/huawei/test_huawei_nas.py | 4 ++-- .../share/drivers/nexenta/ns5/test_jsonrpc.py | 4 ++-- .../drivers/nexenta/ns5/test_nexenta_nas.py | 2 +- .../share/drivers/zfsonlinux/test_driver.py | 2 +- .../share/drivers/zfsonlinux/test_utils.py | 4 ++-- manila/tests/share/test_access.py | 4 ++-- manila/tests/share/test_manager.py | 2 +- manila/tests/test_manager.py | 4 ++-- manila/tests/test_network.py | 4 ++-- manila/tests/test_quota.py | 4 ++-- manila/tests/test_service.py | 2 +- 45 files changed, 88 insertions(+), 88 deletions(-) diff --git a/manila/api/v1/share_manage.py b/manila/api/v1/share_manage.py index 8909b8bc40..dc0ad7177a 100644 --- a/manila/api/v1/share_manage.py +++ b/manila/api/v1/share_manage.py @@ -118,7 +118,7 @@ class ShareManageController(ShareManageMixin, wsgi.Controller): _view_builder_class = share_views.ViewBuilder def __init__(self, *args, **kwargs): - super(self.__class__, self).__init__(*args, **kwargs) + super(ShareManageController, self).__init__(*args, **kwargs) self.share_api = share.API() @wsgi.Controller.api_version('1.0', '2.6') diff --git a/manila/api/v1/share_unmanage.py b/manila/api/v1/share_unmanage.py index e082e56a2c..529975f17d 100644 --- a/manila/api/v1/share_unmanage.py +++ b/manila/api/v1/share_unmanage.py @@ -74,7 +74,7 @@ class ShareUnmanageController(ShareUnmanageMixin, wsgi.Controller): resource_name = "share" def __init__(self, *args, **kwargs): - super(self.__class__, self).__init__(*args, **kwargs) + super(ShareUnmanageController, self).__init__(*args, **kwargs) self.share_api = share.API() @wsgi.Controller.api_version('1.0', '2.6') diff --git a/manila/api/v1/shares.py b/manila/api/v1/shares.py index b8ef2d2731..f35b7506c9 100644 --- a/manila/api/v1/shares.py +++ b/manila/api/v1/shares.py @@ -502,7 +502,7 @@ class ShareController(wsgi.Controller, ShareMixin, wsgi.AdminActionsMixin): _view_builder_class = share_views.ViewBuilder def __init__(self): - super(self.__class__, self).__init__() + super(ShareController, self).__init__() self.share_api = share.API() self._access_view_builder = share_access_views.ViewBuilder() diff --git a/manila/api/v2/share_export_locations.py b/manila/api/v2/share_export_locations.py index 5ac88bac79..babbb55e72 100644 --- a/manila/api/v2/share_export_locations.py +++ b/manila/api/v2/share_export_locations.py @@ -28,7 +28,7 @@ class ShareExportLocationController(wsgi.Controller): def __init__(self): self._view_builder_class = export_locations_views.ViewBuilder self.resource_name = 'share_export_location' - super(self.__class__, self).__init__() + super(ShareExportLocationController, self).__init__() def _verify_share(self, context, share_id): try: diff --git a/manila/api/v2/share_instance_export_locations.py b/manila/api/v2/share_instance_export_locations.py index e31e4a8cc7..38af170670 100644 --- a/manila/api/v2/share_instance_export_locations.py +++ b/manila/api/v2/share_instance_export_locations.py @@ -29,7 +29,7 @@ class ShareInstanceExportLocationController(wsgi.Controller): def __init__(self): self._view_builder_class = export_locations_views.ViewBuilder self.resource_name = 'share_instance_export_location' - super(self.__class__, self).__init__() + super(ShareInstanceExportLocationController, self).__init__() def _verify_share_instance(self, context, share_instance_id): try: diff --git a/manila/api/v2/share_instances.py b/manila/api/v2/share_instances.py index e4dd696e5c..c297b2b701 100644 --- a/manila/api/v2/share_instances.py +++ b/manila/api/v2/share_instances.py @@ -31,7 +31,7 @@ class ShareInstancesController(wsgi.Controller, wsgi.AdminActionsMixin): def __init__(self): self.share_api = share.API() - super(self.__class__, self).__init__() + super(ShareInstancesController, self).__init__() def _get(self, *args, **kwargs): return db.share_instance_get(*args, **kwargs) diff --git a/manila/api/v2/share_snapshot_export_locations.py b/manila/api/v2/share_snapshot_export_locations.py index 056a3bab0d..ffe902c8df 100644 --- a/manila/api/v2/share_snapshot_export_locations.py +++ b/manila/api/v2/share_snapshot_export_locations.py @@ -29,7 +29,7 @@ class ShareSnapshotExportLocationController(wsgi.Controller): self._view_builder_class = ( share_snapshot_export_locations.ViewBuilder) self.resource_name = 'share_snapshot_export_location' - super(self.__class__, self).__init__() + super(ShareSnapshotExportLocationController, self).__init__() @wsgi.Controller.api_version('2.32') @wsgi.Controller.authorize diff --git a/manila/api/v2/share_snapshot_instance_export_locations.py b/manila/api/v2/share_snapshot_instance_export_locations.py index 3a5ec7242a..c06cc02c6e 100644 --- a/manila/api/v2/share_snapshot_instance_export_locations.py +++ b/manila/api/v2/share_snapshot_instance_export_locations.py @@ -29,7 +29,7 @@ class ShareSnapshotInstanceExportLocationController(wsgi.Controller): self._view_builder_class = ( share_snapshot_export_locations.ViewBuilder) self.resource_name = 'share_snapshot_instance_export_location' - super(self.__class__, self).__init__() + super(ShareSnapshotInstanceExportLocationController, self).__init__() @wsgi.Controller.api_version('2.32') @wsgi.Controller.authorize diff --git a/manila/api/v2/share_snapshot_instances.py b/manila/api/v2/share_snapshot_instances.py index 8e8a4d5343..83f0d1d345 100644 --- a/manila/api/v2/share_snapshot_instances.py +++ b/manila/api/v2/share_snapshot_instances.py @@ -32,7 +32,7 @@ class ShareSnapshotInstancesController(wsgi.Controller, def __init__(self): self.share_api = share.API() - super(self.__class__, self).__init__() + super(ShareSnapshotInstancesController, self).__init__() @wsgi.Controller.api_version('2.19') @wsgi.Controller.authorize diff --git a/manila/api/v2/share_types.py b/manila/api/v2/share_types.py index f27deb951f..c66c2e7303 100644 --- a/manila/api/v2/share_types.py +++ b/manila/api/v2/share_types.py @@ -47,7 +47,7 @@ class ShareTypesController(wsgi.Controller): def __getattr__(self, key): if key == 'os-share-type-access': return self.share_type_access - return super(self.__class__, self).__getattr__(key) + return super(ShareTypesController, self).__getattr__(key) def _notify_share_type_error(self, context, method, payload): rpc.get_notifier('shareType').error(context, method, payload) diff --git a/manila/api/v2/shares.py b/manila/api/v2/shares.py index 5e54a4e6c6..5a0d29d3c0 100644 --- a/manila/api/v2/shares.py +++ b/manila/api/v2/shares.py @@ -47,7 +47,7 @@ class ShareController(shares.ShareMixin, _view_builder_class = share_views.ViewBuilder def __init__(self): - super(self.__class__, self).__init__() + super(ShareController, self).__init__() self.share_api = share.API() self._access_view_builder = share_access_views.ViewBuilder() self._migration_view_builder = share_migration_views.ViewBuilder() diff --git a/manila/scheduler/manager.py b/manila/scheduler/manager.py index 5f90277aca..525a20957d 100644 --- a/manila/scheduler/manager.py +++ b/manila/scheduler/manager.py @@ -81,7 +81,7 @@ class SchedulerManager(manager.Manager): self.driver = importutils.import_object(scheduler_driver) self.message_api = message_api.API() - super(self.__class__, self).__init__(*args, **kwargs) + super(SchedulerManager, self).__init__(*args, **kwargs) def init_host(self): ctxt = context.get_admin_context() diff --git a/manila/share/drivers/hitachi/hsp/driver.py b/manila/share/drivers/hitachi/hsp/driver.py index c2ffe3da57..1cc52d8540 100644 --- a/manila/share/drivers/hitachi/hsp/driver.py +++ b/manila/share/drivers/hitachi/hsp/driver.py @@ -49,7 +49,7 @@ class HitachiHSPDriver(driver.ShareDriver): """ def __init__(self, *args, **kwargs): - super(self.__class__, self).__init__( + super(HitachiHSPDriver, self).__init__( [False], *args, config_opts=[hitachi_hsp_opts], **kwargs) self.private_storage = kwargs.get('private_storage') diff --git a/manila/share/drivers/qnap/qnap.py b/manila/share/drivers/qnap/qnap.py index 1546e4fb4c..2efdba6ce2 100644 --- a/manila/share/drivers/qnap/qnap.py +++ b/manila/share/drivers/qnap/qnap.py @@ -275,7 +275,7 @@ class QnapShareDriver(driver.ShareDriver): 'driver_handles_share_servers'), 'pools': [single_pool], } - super(self.__class__, self)._update_share_stats(data) + super(QnapShareDriver, self)._update_share_stats(data) @utils.retry(exception=exception.ShareBackendException, interval=3, diff --git a/manila/share/drivers/zfsonlinux/driver.py b/manila/share/drivers/zfsonlinux/driver.py index 8a9141caf9..8b1925914c 100644 --- a/manila/share/drivers/zfsonlinux/driver.py +++ b/manila/share/drivers/zfsonlinux/driver.py @@ -164,7 +164,7 @@ def get_backend_configuration(backend_name): class ZFSonLinuxShareDriver(zfs_utils.ExecuteMixin, driver.ShareDriver): def __init__(self, *args, **kwargs): - super(self.__class__, self).__init__( + super(ZFSonLinuxShareDriver, self).__init__( [False], *args, config_opts=[zfsonlinux_opts], **kwargs) self.replica_snapshot_prefix = ( self.configuration.zfs_replica_snapshot_prefix) @@ -325,7 +325,7 @@ class ZFSonLinuxShareDriver(zfs_utils.ExecuteMixin, driver.ShareDriver): def do_setup(self, context): """Perform basic setup and checks.""" - super(self.__class__, self).do_setup(context) + super(ZFSonLinuxShareDriver, self).do_setup(context) self._setup_helpers() for ip in (self.share_export_ip, self.service_ip): if not utils.is_valid_ip_address(ip, 4): @@ -382,7 +382,7 @@ class ZFSonLinuxShareDriver(zfs_utils.ExecuteMixin, driver.ShareDriver): } if self.configuration.replication_domain: data['replication_type'] = 'readable' - super(self.__class__, self)._update_share_stats(data) + super(ZFSonLinuxShareDriver, self)._update_share_stats(data) def _get_share_name(self, share_id): """Returns name of dataset used for given share.""" diff --git a/manila/tests/api/v1/test_share_snapshots.py b/manila/tests/api/v1/test_share_snapshots.py index b698a8c153..58c1f63fcb 100644 --- a/manila/tests/api/v1/test_share_snapshots.py +++ b/manila/tests/api/v1/test_share_snapshots.py @@ -37,7 +37,7 @@ class ShareSnapshotAPITest(test.TestCase): """Share Snapshot API Test.""" def setUp(self): - super(self.__class__, self).setUp() + super(ShareSnapshotAPITest, self).setUp() self.controller = share_snapshots.ShareSnapshotsController() self.mock_object(share_api.API, 'get', stubs.stub_share_get) @@ -353,7 +353,7 @@ class ShareSnapshotAPITest(test.TestCase): class ShareSnapshotAdminActionsAPITest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareSnapshotAdminActionsAPITest, self).setUp() self.controller = share_snapshots.ShareSnapshotsController() self.flags(rpc_backend='manila.openstack.common.rpc.impl_fake') self.admin_context = context.RequestContext('admin', 'fake', True) diff --git a/manila/tests/api/v1/test_shares.py b/manila/tests/api/v1/test_shares.py index 12b2c10723..0a8a8bad5c 100644 --- a/manila/tests/api/v1/test_shares.py +++ b/manila/tests/api/v1/test_shares.py @@ -46,7 +46,7 @@ class ShareAPITest(test.TestCase): """Share API Test.""" def setUp(self): - super(self.__class__, self).setUp() + super(ShareAPITest, self).setUp() self.controller = shares.ShareController() self.mock_object(db, 'availability_zone_get') self.mock_object(share_api.API, 'get_all', @@ -778,7 +778,7 @@ def _fake_access_get(self, ctxt, access_id): class ShareActionsTest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareActionsTest, self).setUp() self.controller = shares.ShareController() self.mock_object(share_api.API, 'get', stubs.stub_share_get) self.mock_policy_check = self.mock_object(policy, 'check_policy') @@ -1000,7 +1000,7 @@ class ShareActionsTest(test.TestCase): class ShareAdminActionsAPITest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareAdminActionsAPITest, self).setUp() CONF.set_default("default_share_type", None) self.flags(rpc_backend='manila.openstack.common.rpc.impl_fake') self.share_api = share_api.API() diff --git a/manila/tests/api/v2/test_quota_class_sets.py b/manila/tests/api/v2/test_quota_class_sets.py index f0662044e1..3b7051e5d0 100644 --- a/manila/tests/api/v2/test_quota_class_sets.py +++ b/manila/tests/api/v2/test_quota_class_sets.py @@ -49,7 +49,7 @@ REQ_MEMBER.environ['manila.context'].is_admin = False class QuotaSetsControllerTest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(QuotaSetsControllerTest, self).setUp() self.controller = quota_class_sets.QuotaClassSetsController() self.resource_name = self.controller.resource_name self.class_name = 'foo_class_name' diff --git a/manila/tests/api/v2/test_quota_sets.py b/manila/tests/api/v2/test_quota_sets.py index 99648a5fad..49cc2d937a 100644 --- a/manila/tests/api/v2/test_quota_sets.py +++ b/manila/tests/api/v2/test_quota_sets.py @@ -53,7 +53,7 @@ def _get_request(is_admin, user_in_url): class QuotaSetsControllerTest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(QuotaSetsControllerTest, self).setUp() self.controller = quota_sets.QuotaSetsController() self.resource_name = self.controller.resource_name self.project_id = 'foo_project_id' diff --git a/manila/tests/api/v2/test_services.py b/manila/tests/api/v2/test_services.py index 941eb9286a..8ec047970e 100644 --- a/manila/tests/api/v2/test_services.py +++ b/manila/tests/api/v2/test_services.py @@ -142,7 +142,7 @@ def fake_utcnow(): class ServicesTest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ServicesTest, self).setUp() self.mock_object(db, "service_get_all", fake_service_get_all) self.mock_object(timeutils, "utcnow", fake_utcnow) diff --git a/manila/tests/api/v2/test_share_export_locations.py b/manila/tests/api/v2/test_share_export_locations.py index 224f6a7490..cad62dd315 100644 --- a/manila/tests/api/v2/test_share_export_locations.py +++ b/manila/tests/api/v2/test_share_export_locations.py @@ -37,7 +37,7 @@ class ShareExportLocationsAPITest(test.TestCase): return req def setUp(self): - super(self.__class__, self).setUp() + super(ShareExportLocationsAPITest, self).setUp() self.controller = ( export_locations.ShareExportLocationController()) self.resource_name = self.controller.resource_name diff --git a/manila/tests/api/v2/test_share_group_snapshots.py b/manila/tests/api/v2/test_share_group_snapshots.py index e1eebb501e..52d86e3589 100644 --- a/manila/tests/api/v2/test_share_group_snapshots.py +++ b/manila/tests/api/v2/test_share_group_snapshots.py @@ -42,7 +42,7 @@ CONF = cfg.CONF class ShareGroupSnapshotAPITest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareGroupSnapshotAPITest, self).setUp() self.controller = share_group_snapshots.ShareGroupSnapshotController() self.resource_name = self.controller.resource_name self.api_version = '2.31' diff --git a/manila/tests/api/v2/test_share_group_types.py b/manila/tests/api/v2/test_share_group_types.py index 4810727b2a..fb9ca83bca 100644 --- a/manila/tests/api/v2/test_share_group_types.py +++ b/manila/tests/api/v2/test_share_group_types.py @@ -70,7 +70,7 @@ def fake_request(url, admin=False, experimental=True, version='2.31', class ShareGroupTypesAPITest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareGroupTypesAPITest, self).setUp() self.flags(host='fake') self.controller = types.ShareGroupTypesController() self.resource_name = self.controller.resource_name @@ -434,7 +434,7 @@ class ShareGroupTypesAPITest(test.TestCase): class ShareGroupTypeAccessTest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareGroupTypeAccessTest, self).setUp() self.controller = types.ShareGroupTypesController() def test_list_type_access_public(self): diff --git a/manila/tests/api/v2/test_share_groups.py b/manila/tests/api/v2/test_share_groups.py index 0ce9abec6a..0cc037ab14 100644 --- a/manila/tests/api/v2/test_share_groups.py +++ b/manila/tests/api/v2/test_share_groups.py @@ -47,7 +47,7 @@ class ShareGroupAPITest(test.TestCase): """Consistency Groups API Test suite.""" def setUp(self): - super(self.__class__, self).setUp() + super(ShareGroupAPITest, self).setUp() self.controller = share_groups.ShareGroupController() self.resource_name = self.controller.resource_name self.fake_share_type = {'id': six.text_type(uuidutils.generate_uuid())} diff --git a/manila/tests/api/v2/test_share_instance_export_locations.py b/manila/tests/api/v2/test_share_instance_export_locations.py index 8a7aa15a3e..62c72f7fc0 100644 --- a/manila/tests/api/v2/test_share_instance_export_locations.py +++ b/manila/tests/api/v2/test_share_instance_export_locations.py @@ -37,7 +37,7 @@ class ShareInstanceExportLocationsAPITest(test.TestCase): return req def setUp(self): - super(self.__class__, self).setUp() + super(ShareInstanceExportLocationsAPITest, self).setUp() self.controller = ( export_locations.ShareInstanceExportLocationController()) self.resource_name = self.controller.resource_name diff --git a/manila/tests/api/v2/test_share_instances.py b/manila/tests/api/v2/test_share_instances.py index 91828cad47..6fccc22045 100644 --- a/manila/tests/api/v2/test_share_instances.py +++ b/manila/tests/api/v2/test_share_instances.py @@ -36,7 +36,7 @@ class ShareInstancesAPITest(test.TestCase): """Share instances API Test.""" def setUp(self): - super(self.__class__, self).setUp() + super(ShareInstancesAPITest, self).setUp() self.controller = share_instances.ShareInstancesController() self.resource_name = self.controller.resource_name self.mock_policy_check = self.mock_object( diff --git a/manila/tests/api/v2/test_share_snapshots.py b/manila/tests/api/v2/test_share_snapshots.py index a3b78c9253..7c05c5715e 100644 --- a/manila/tests/api/v2/test_share_snapshots.py +++ b/manila/tests/api/v2/test_share_snapshots.py @@ -55,7 +55,7 @@ class ShareSnapshotAPITest(test.TestCase): """Share Snapshot API Test.""" def setUp(self): - super(self.__class__, self).setUp() + super(ShareSnapshotAPITest, self).setUp() self.controller = share_snapshots.ShareSnapshotsController() self.mock_object(share_api.API, 'get', stubs.stub_share_get) @@ -579,7 +579,7 @@ class ShareSnapshotAPITest(test.TestCase): class ShareSnapshotAdminActionsAPITest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareSnapshotAdminActionsAPITest, self).setUp() self.controller = share_snapshots.ShareSnapshotsController() self.flags(rpc_backend='manila.openstack.common.rpc.impl_fake') self.admin_context = context.RequestContext('admin', 'fake', True) diff --git a/manila/tests/api/v2/test_share_types.py b/manila/tests/api/v2/test_share_types.py index ac6fd64c4b..b29146aced 100644 --- a/manila/tests/api/v2/test_share_types.py +++ b/manila/tests/api/v2/test_share_types.py @@ -119,7 +119,7 @@ def make_create_body(name="test_share_1", extra_specs=None, class ShareTypesAPITest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareTypesAPITest, self).setUp() self.flags(host='fake') self.controller = types.ShareTypesController() self.resource_name = self.controller.resource_name @@ -569,7 +569,7 @@ class FakeRequest(object): class ShareTypeAccessTest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareTypeAccessTest, self).setUp() self.controller = types.ShareTypesController() self.req = FakeRequest() self.mock_object(db, 'share_type_get', fake_share_type_get) diff --git a/manila/tests/api/v2/test_shares.py b/manila/tests/api/v2/test_shares.py index e4eb4853ae..3219e68221 100644 --- a/manila/tests/api/v2/test_shares.py +++ b/manila/tests/api/v2/test_shares.py @@ -51,7 +51,7 @@ class ShareAPITest(test.TestCase): """Share API Test.""" def setUp(self): - super(self.__class__, self).setUp() + super(ShareAPITest, self).setUp() self.controller = shares.ShareController() self.mock_object(db, 'availability_zone_get') self.mock_object(share_api.API, 'get_all', @@ -1910,7 +1910,7 @@ def _fake_access_get(self, ctxt, access_id): class ShareActionsTest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareActionsTest, self).setUp() self.controller = shares.ShareController() self.mock_object(share_api.API, 'get', stubs.stub_share_get) @@ -2321,7 +2321,7 @@ class ShareActionsTest(test.TestCase): class ShareAdminActionsAPITest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareAdminActionsAPITest, self).setUp() CONF.set_default("default_share_type", None) self.flags(rpc_backend='manila.openstack.common.rpc.impl_fake') self.share_api = share_api.API() @@ -2442,7 +2442,7 @@ class ShareAdminActionsAPITest(test.TestCase): class ShareUnmanageTest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareUnmanageTest, self).setUp() self.controller = shares.ShareController() self.mock_object(share_api.API, 'get_all', stubs.stub_get_all_shares) @@ -2587,7 +2587,7 @@ def get_fake_manage_body(export_path='/fake', service_host='fake@host#POOL', class ShareManageTest(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareManageTest, self).setUp() self.controller = shares.ShareController() self.resource_name = self.controller.resource_name self.request = fakes.HTTPRequest.blank( diff --git a/manila/tests/db/sqlalchemy/test_api.py b/manila/tests/db/sqlalchemy/test_api.py index 8cb01a7419..4e0c8714ae 100644 --- a/manila/tests/db/sqlalchemy/test_api.py +++ b/manila/tests/db/sqlalchemy/test_api.py @@ -1499,7 +1499,7 @@ class ShareSnapshotDatabaseAPITestCase(test.TestCase): class ShareExportLocationsDatabaseAPITestCase(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareExportLocationsDatabaseAPITestCase, self).setUp() self.ctxt = context.get_admin_context() def test_update_valid_order(self): @@ -1597,7 +1597,8 @@ class ShareExportLocationsDatabaseAPITestCase(test.TestCase): class ShareInstanceExportLocationsMetadataDatabaseAPITestCase(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + clname = ShareInstanceExportLocationsMetadataDatabaseAPITestCase + super(clname, self).setUp() self.ctxt = context.get_admin_context() share_id = 'fake_share_id' instances = [ @@ -2868,7 +2869,7 @@ class PurgeDeletedTest(test.TestCase): class ShareTypeAPITestCase(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareTypeAPITestCase, self).setUp() self.ctxt = context.RequestContext( user_id='user_id', project_id='project_id', is_admin=True) diff --git a/manila/tests/scheduler/test_manager.py b/manila/tests/scheduler/test_manager.py index 91adfe7428..5b341e2104 100644 --- a/manila/tests/scheduler/test_manager.py +++ b/manila/tests/scheduler/test_manager.py @@ -48,7 +48,6 @@ CONF = cfg.CONF class SchedulerManagerTestCase(test.TestCase): """Test case for scheduler manager.""" - manager_cls = manager.SchedulerManager driver_cls = base.Scheduler driver_cls_name = 'manila.scheduler.drivers.base.Scheduler' @@ -68,7 +67,7 @@ class SchedulerManagerTestCase(test.TestCase): reload(manager) self.flags(scheduler_driver=self.driver_cls_name) - self.manager = self.manager_cls() + self.manager = manager.SchedulerManager() self.context = context.RequestContext('fake_user', 'fake_project') self.topic = 'fake_topic' self.fake_args = (1, 2, 3) diff --git a/manila/tests/share/drivers/dell_emc/plugins/vmax/test_object_manager.py b/manila/tests/share/drivers/dell_emc/plugins/vmax/test_object_manager.py index 2809d6882e..2eaa7d1d1e 100644 --- a/manila/tests/share/drivers/dell_emc/plugins/vmax/test_object_manager.py +++ b/manila/tests/share/drivers/dell_emc/plugins/vmax/test_object_manager.py @@ -124,7 +124,7 @@ class StorageObjectTestCase(StorageObjectTestCaseBase): class FileSystemTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(FileSystemTestCase, self).setUp() self.hook = utils.RequestSideEffect() self.ssh_hook = utils.SSHSideEffect() @@ -537,7 +537,7 @@ class FileSystemTestCase(StorageObjectTestCaseBase): class MountPointTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(MountPointTestCase, self).setUp() self.hook = utils.RequestSideEffect() def test_create_mount_point_on_vdm(self): @@ -854,7 +854,7 @@ class MountPointTestCase(StorageObjectTestCaseBase): class VDMTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(VDMTestCase, self).setUp() self.hook = utils.RequestSideEffect() self.ssh_hook = utils.SSHSideEffect() @@ -1118,7 +1118,7 @@ class VDMTestCase(StorageObjectTestCaseBase): class StoragePoolTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(StoragePoolTestCase, self).setUp() self.hook = utils.RequestSideEffect() def test_get_pool(self): @@ -1185,7 +1185,7 @@ class StoragePoolTestCase(StorageObjectTestCaseBase): class MoverTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(MoverTestCase, self).setUp() self.hook = utils.RequestSideEffect() self.ssh_hook = utils.SSHSideEffect() @@ -1362,7 +1362,7 @@ class MoverTestCase(StorageObjectTestCaseBase): class SnapshotTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(SnapshotTestCase, self).setUp() self.hook = utils.RequestSideEffect() def test_create_snapshot(self): @@ -1552,7 +1552,7 @@ class SnapshotTestCase(StorageObjectTestCaseBase): @ddt.ddt class MoverInterfaceTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(MoverInterfaceTestCase, self).setUp() self.hook = utils.RequestSideEffect() def test_create_mover_interface(self): @@ -1845,7 +1845,7 @@ class MoverInterfaceTestCase(StorageObjectTestCaseBase): class DNSDomainTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(DNSDomainTestCase, self).setUp() self.hook = utils.RequestSideEffect() def test_create_dns_domain(self): @@ -1955,7 +1955,7 @@ class DNSDomainTestCase(StorageObjectTestCaseBase): class CIFSServerTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(CIFSServerTestCase, self).setUp() self.hook = utils.RequestSideEffect() def test_create_cifs_server(self): @@ -2393,7 +2393,7 @@ class CIFSServerTestCase(StorageObjectTestCaseBase): class CIFSShareTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(CIFSShareTestCase, self).setUp() self.hook = utils.RequestSideEffect() self.ssh_hook = utils.SSHSideEffect() @@ -2799,7 +2799,7 @@ class CIFSShareTestCase(StorageObjectTestCaseBase): class NFSShareTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(NFSShareTestCase, self).setUp() self.ssh_hook = utils.SSHSideEffect() def test_create_nfs_share(self): diff --git a/manila/tests/share/drivers/dell_emc/plugins/vnx/test_object_manager.py b/manila/tests/share/drivers/dell_emc/plugins/vnx/test_object_manager.py index 2875540a25..8657e8015f 100644 --- a/manila/tests/share/drivers/dell_emc/plugins/vnx/test_object_manager.py +++ b/manila/tests/share/drivers/dell_emc/plugins/vnx/test_object_manager.py @@ -126,7 +126,7 @@ class StorageObjectTestCase(StorageObjectTestCaseBase): class FileSystemTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(FileSystemTestCase, self).setUp() self.hook = utils.RequestSideEffect() self.ssh_hook = utils.SSHSideEffect() @@ -539,7 +539,7 @@ class FileSystemTestCase(StorageObjectTestCaseBase): class MountPointTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(MountPointTestCase, self).setUp() self.hook = utils.RequestSideEffect() def test_create_mount_point_on_vdm(self): @@ -857,7 +857,7 @@ class MountPointTestCase(StorageObjectTestCaseBase): @ddt.ddt class VDMTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(VDMTestCase, self).setUp() self.hook = utils.RequestSideEffect() self.ssh_hook = utils.SSHSideEffect() @@ -1123,7 +1123,7 @@ class VDMTestCase(StorageObjectTestCaseBase): class StoragePoolTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(StoragePoolTestCase, self).setUp() self.hook = utils.RequestSideEffect() def test_get_pool(self): @@ -1190,7 +1190,7 @@ class StoragePoolTestCase(StorageObjectTestCaseBase): class MoverTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(MoverTestCase, self).setUp() self.hook = utils.RequestSideEffect() self.ssh_hook = utils.SSHSideEffect() @@ -1367,7 +1367,7 @@ class MoverTestCase(StorageObjectTestCaseBase): class SnapshotTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(SnapshotTestCase, self).setUp() self.hook = utils.RequestSideEffect() def test_create_snapshot(self): @@ -1557,7 +1557,7 @@ class SnapshotTestCase(StorageObjectTestCaseBase): @ddt.ddt class MoverInterfaceTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(MoverInterfaceTestCase, self).setUp() self.hook = utils.RequestSideEffect() def test_create_mover_interface(self): @@ -1850,7 +1850,7 @@ class MoverInterfaceTestCase(StorageObjectTestCaseBase): class DNSDomainTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(DNSDomainTestCase, self).setUp() self.hook = utils.RequestSideEffect() def test_create_dns_domain(self): @@ -1960,7 +1960,7 @@ class DNSDomainTestCase(StorageObjectTestCaseBase): class CIFSServerTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(CIFSServerTestCase, self).setUp() self.hook = utils.RequestSideEffect() def test_create_cifs_server(self): @@ -2398,7 +2398,7 @@ class CIFSServerTestCase(StorageObjectTestCaseBase): class CIFSShareTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(CIFSShareTestCase, self).setUp() self.hook = utils.RequestSideEffect() self.ssh_hook = utils.SSHSideEffect() @@ -2804,7 +2804,7 @@ class CIFSShareTestCase(StorageObjectTestCaseBase): class NFSShareTestCase(StorageObjectTestCaseBase): def setUp(self): - super(self.__class__, self).setUp() + super(NFSShareTestCase, self).setUp() self.ssh_hook = utils.SSHSideEffect() def test_create_nfs_share(self): diff --git a/manila/tests/share/drivers/dummy.py b/manila/tests/share/drivers/dummy.py index ec6c27c0a4..b2514973f4 100644 --- a/manila/tests/share/drivers/dummy.py +++ b/manila/tests/share/drivers/dummy.py @@ -133,7 +133,7 @@ class DummyDriver(driver.ShareDriver): def __init__(self, *args, **kwargs): """Do initialization.""" - super(self.__class__, self).__init__( + super(DummyDriver, self).__init__( [False, True], *args, config_opts=[dummy_opts], **kwargs) self._verify_configuration() self.private_storage = kwargs.get('private_storage') @@ -393,7 +393,7 @@ class DummyDriver(driver.ShareDriver): } if self.configuration.replication_domain: data["replication_type"] = "readable" - super(self.__class__, self)._update_share_stats(data) + super(DummyDriver, self)._update_share_stats(data) def get_share_server_pools(self, share_server): """Return list of pools related to a particular share server.""" diff --git a/manila/tests/share/drivers/huawei/test_huawei_nas.py b/manila/tests/share/drivers/huawei/test_huawei_nas.py index eee45054ea..87729247a2 100644 --- a/manila/tests/share/drivers/huawei/test_huawei_nas.py +++ b/manila/tests/share/drivers/huawei/test_huawei_nas.py @@ -768,7 +768,7 @@ class FakeHuaweiNasHelper(helper.RestHelper): class FakeRpcClient(rpcapi.HuaweiV3API): def __init__(self, helper): - super(self.__class__, self).__init__() + super(FakeRpcClient, self).__init__() self.replica_mgr = replication.ReplicaPairManager(helper) class fake_call_context(object): @@ -784,7 +784,7 @@ class FakeRpcClient(rpcapi.HuaweiV3API): remote_device_wwn, remote_fs_id): self.client.prepare = mock.Mock( return_value=self.fake_call_context(self.replica_mgr)) - return super(self.__class__, self).create_replica_pair( + return super(FakeRpcClient, self).create_replica_pair( context, host, local_share_info, remote_device_wwn, remote_fs_id) diff --git a/manila/tests/share/drivers/nexenta/ns5/test_jsonrpc.py b/manila/tests/share/drivers/nexenta/ns5/test_jsonrpc.py index 8dd0fe3864..0bdb79b091 100644 --- a/manila/tests/share/drivers/nexenta/ns5/test_jsonrpc.py +++ b/manila/tests/share/drivers/nexenta/ns5/test_jsonrpc.py @@ -27,10 +27,10 @@ PATH_TO_RPC = 'manila.share.drivers.nexenta.ns5.jsonrpc.NexentaJSONProxy' class TestNexentaJSONProxy(test.TestCase): def __init__(self, method): - super(self.__class__, self).__init__(method) + super(TestNexentaJSONProxy, self).__init__(method) def setUp(self): - super(self.__class__, self).setUp() + super(TestNexentaJSONProxy, self).setUp() self.nef_get = jsonrpc.NexentaJSONProxy( 'http', '1.1.1.1', '8080', 'user', 'pass', 'get') self.nef_post = jsonrpc.NexentaJSONProxy( diff --git a/manila/tests/share/drivers/nexenta/ns5/test_nexenta_nas.py b/manila/tests/share/drivers/nexenta/ns5/test_nexenta_nas.py index a86db5f8f7..f4ce220b20 100644 --- a/manila/tests/share/drivers/nexenta/ns5/test_nexenta_nas.py +++ b/manila/tests/share/drivers/nexenta/ns5/test_nexenta_nas.py @@ -36,7 +36,7 @@ class TestNexentaNasDriver(test.TestCase): return getattr(self.cfg, opt) self.cfg = conf.Configuration(None) self.cfg.nexenta_host = '1.1.1.1' - super(self.__class__, self).setUp() + super(TestNexentaNasDriver, self).setUp() self.ctx = context.get_admin_context() self.mock_object( self.cfg, 'safe_get', mock.Mock(side_effect=_safe_get)) diff --git a/manila/tests/share/drivers/zfsonlinux/test_driver.py b/manila/tests/share/drivers/zfsonlinux/test_driver.py index a91c970b42..800ae56751 100644 --- a/manila/tests/share/drivers/zfsonlinux/test_driver.py +++ b/manila/tests/share/drivers/zfsonlinux/test_driver.py @@ -143,7 +143,7 @@ class ZFSonLinuxShareDriverTestCase(test.TestCase): def setUp(self): self.mock_object(zfs_driver.CONF, '_check_required_opts') - super(self.__class__, self).setUp() + super(ZFSonLinuxShareDriverTestCase, self).setUp() self._context = context.get_admin_context() self.ssh_executor = self.mock_object(ganesha_utils, 'SSHExecutor') self.configuration = FakeConfig() diff --git a/manila/tests/share/drivers/zfsonlinux/test_utils.py b/manila/tests/share/drivers/zfsonlinux/test_utils.py index 3252994714..2f50a5f81e 100644 --- a/manila/tests/share/drivers/zfsonlinux/test_utils.py +++ b/manila/tests/share/drivers/zfsonlinux/test_utils.py @@ -55,7 +55,7 @@ class FakeShareDriver(zfs_utils.ExecuteMixin): class ExecuteMixinTestCase(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ExecuteMixinTestCase, self).setUp() self.ssh_executor = self.mock_object(ganesha_utils, 'SSHExecutor') self.driver = FakeShareDriver() @@ -238,7 +238,7 @@ foo_res opt_3 some_value local""" class NFSviaZFSHelperTestCase(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(NFSviaZFSHelperTestCase, self).setUp() configuration = get_fake_configuration() self.out = "fake_out" self.mock_object( diff --git a/manila/tests/share/test_access.py b/manila/tests/share/test_access.py index 2c0f8f1447..bb24e7c9ed 100644 --- a/manila/tests/share/test_access.py +++ b/manila/tests/share/test_access.py @@ -39,7 +39,7 @@ class LockedOperationsTestCase(test.TestCase): pass def setUp(self): - super(self.__class__, self).setUp() + super(LockedOperationsTestCase, self).setUp() self.access_helper = self.FakeAccessHelper() self.context = context.RequestContext('fake_user', 'fake_project') self.lock_call = self.mock_object( @@ -59,7 +59,7 @@ class LockedOperationsTestCase(test.TestCase): class ShareInstanceAccessDatabaseMixinTestCase(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ShareInstanceAccessDatabaseMixinTestCase, self).setUp() self.driver = mock.Mock() self.access_helper = access.ShareInstanceAccess(db, self.driver) self.context = context.RequestContext('fake_user', 'fake_project') diff --git a/manila/tests/share/test_manager.py b/manila/tests/share/test_manager.py index 80856b3800..67ebd1a30a 100644 --- a/manila/tests/share/test_manager.py +++ b/manila/tests/share/test_manager.py @@ -67,7 +67,7 @@ class LockedOperationsTestCase(test.TestCase): pass def setUp(self): - super(self.__class__, self).setUp() + super(LockedOperationsTestCase, self).setUp() self.manager = self.FakeManager() self.fake_context = test_fakes.FakeRequestContext self.lock_call = self.mock_object( diff --git a/manila/tests/test_manager.py b/manila/tests/test_manager.py index fb08c7e291..78a904c03c 100644 --- a/manila/tests/test_manager.py +++ b/manila/tests/test_manager.py @@ -27,7 +27,7 @@ from manila import test class ManagerTestCase(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(ManagerTestCase, self).setUp() self.host = 'host' self.db_driver = 'fake_driver' self.mock_object(importutils, 'import_module') @@ -60,7 +60,7 @@ class ManagerTestCase(test.TestCase): class SchedulerDependentManagerTestCase(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(SchedulerDependentManagerTestCase, self).setUp() self.context = 'fake_context' self.host = 'host' self.db_driver = 'fake_driver' diff --git a/manila/tests/test_network.py b/manila/tests/test_network.py index e4ece45ea0..6795764755 100644 --- a/manila/tests/test_network.py +++ b/manila/tests/test_network.py @@ -28,7 +28,7 @@ CONF = cfg.CONF class APITestCase(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(APITestCase, self).setUp() self.mock_object(importutils, 'import_class') def test_init_api_with_default_config_group_name(self): @@ -65,7 +65,7 @@ class APITestCase(test.TestCase): class NetworkBaseAPITestCase(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(NetworkBaseAPITestCase, self).setUp() self.db_driver = 'fake_driver' self.mock_object(importutils, 'import_module') diff --git a/manila/tests/test_quota.py b/manila/tests/test_quota.py index f453c345b1..8277ce41e1 100644 --- a/manila/tests/test_quota.py +++ b/manila/tests/test_quota.py @@ -28,7 +28,7 @@ CONF = cfg.CONF class DbQuotaDriverTestCase(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(DbQuotaDriverTestCase, self).setUp() self.project_id = 'fake_project_id' self.user_id = 'fake_user_id' self.share_type_id = 'fake_share_type_id' @@ -462,7 +462,7 @@ class DbQuotaDriverTestCase(test.TestCase): class QuotaEngineTestCase(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(QuotaEngineTestCase, self).setUp() self.ctxt = 'fake_context' self.mock_class('manila.quota.DbQuotaDriver') self.engine = quota.QuotaEngine() diff --git a/manila/tests/test_service.py b/manila/tests/test_service.py index 4e67ed547d..2d1727c88d 100644 --- a/manila/tests/test_service.py +++ b/manila/tests/test_service.py @@ -203,7 +203,7 @@ class ServiceTestCase(test.TestCase): class TestWSGIService(test.TestCase): def setUp(self): - super(self.__class__, self).setUp() + super(TestWSGIService, self).setUp() self.mock_object(wsgi.Loader, 'load_app') self.test_service = service.WSGIService("test_service")