Skip to content

Commit de4e4e1

Browse files
committed
two examples of teardown from super
1 parent a3f4e5f commit de4e4e1

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

test/integration/component/test_volumes.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,11 +1454,7 @@ def setUpClass(cls):
14541454

14551455
@classmethod
14561456
def tearDownClass(cls):
1457-
try:
1458-
cleanup_resources(cls.api_client, cls._cleanup)
1459-
except Exception as e:
1460-
raise Exception("Warning: Exception during cleanup : %s" % e)
1461-
return
1457+
super(TestMigrateVolume,cls).tearDownClass()
14621458

14631459
def setUp(self):
14641460
self.apiclient = self.testClient.getApiClient()
@@ -1470,8 +1466,7 @@ def setUp(self):
14701466
return
14711467

14721468
def tearDown(self):
1473-
cleanup_resources(self.apiclient, self.cleanup)
1474-
return
1469+
super(TestMigrateVolume,self).tearDownClass()
14751470

14761471
@attr(tags=["advanced", "sg", "advancedsg"], required_hardware='true')
14771472
def test_01_migrateVolume(self):

test/integration/testpaths/testpath_storage_migration.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def setUpClass(cls):
324324
@classmethod
325325
def tearDownClass(cls):
326326
try:
327-
cleanup_resources(cls.apiclient, cls._cleanup)
327+
cleanup_resources(cls.apiclient, reversed(cls._cleanup))
328328
except Exception as e:
329329
raise Exception("Warning: Exception during cleanup : %s" % e)
330330

@@ -335,13 +335,9 @@ def setUp(self):
335335
self.cleanup = []
336336

337337
def tearDown(self):
338-
try:
339-
for storagePool in self.pools:
340-
StoragePool.update(self.apiclient, id=storagePool.id, tags="")
341-
cleanup_resources(self.apiclient, self.cleanup)
342-
except Exception as e:
343-
raise Exception("Warning: Exception during cleanup : %s" % e)
344-
return
338+
for storagePool in self.pools:
339+
StoragePool.update(self.apiclient, id=storagePool.id, tags="")
340+
super(TestStorageMigration,self).tearDown()
345341

346342
@attr(tags=["advanced", "basic"], required_hardware="true")
347343
def test_01_migrate_root_and_data_disk_nonlive(self):

0 commit comments

Comments
 (0)