Zhou Zheng Sheng has uploaded a new change for review.
Change subject: xmlrpcTests: change skipNoKVM into a decorator ......................................................................
xmlrpcTests: change skipNoKVM into a decorator
After using skipNoKVM as decorator, the code looks cleaner.
class XMLRPCTest(TestCaseBase): @skipNoKVM def testMethod(self): ...
Change-Id: I3b8507f3c5f1e1d2712a37fba0162c9aaf56c3a3 Signed-off-by: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com --- M tests/functional/xmlrpcTests.py 1 file changed, 14 insertions(+), 12 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/9783/1
diff --git a/tests/functional/xmlrpcTests.py b/tests/functional/xmlrpcTests.py index 79e8109..c259533 100644 --- a/tests/functional/xmlrpcTests.py +++ b/tests/functional/xmlrpcTests.py @@ -86,6 +86,17 @@ return path
+def skipNoKVM(method): + def wrapped(self): + r = self.s.getVdsCapabilities() + self.assertVdsOK(r) + if r['info']['kvmEnabled'] != 'true': + raise SkipTest('KVM is not enabled') + return method(self) + wrapped.func_name = method.func_name + return wrapped + + class XMLRPCTest(TestCaseBase): UPSTATES = frozenset(('Up', 'Powering up', 'Running'))
@@ -127,15 +138,8 @@ 'error code: %s, message: %s' % (vdsResult['status']['code'], vdsResult['status']['message']))
- def skipNoKVM(self): - r = self.s.getVdsCapabilities() - self.assertVdsOK(r) - if r['info']['kvmEnabled'] != 'true': - raise SkipTest('KVM is not enabled') - + @skipNoKVM def testStartEmptyVM(self): - self.skipNoKVM() - VMID = '66666666-ffff-4444-bbbb-333333333333'
r = self.s.create({'memSize': '100', 'display': 'vnc', 'vmId': VMID, @@ -148,9 +152,8 @@ r = self.s.destroy(VMID) self.assertVdsOK(r)
+ @skipNoKVM def testStartSmallVM(self): - self.skipNoKVM() - customization = {'vmId': '77777777-ffff-3333-bbbb-222222222222', 'vmName': 'vdsm_testSmallVM'}
@@ -198,9 +201,8 @@ with RollbackContext() as rollback: self._createVdsmStorageLayout(conf, rollback)
+ @skipNoKVM def testSimpleVMoLocalfs(self): - self.skipNoKVM() - localfs = storageLayouts['localfs'] drives = [] for poolid, domains in localfs['layout'].iteritems():
-- To view, visit http://gerrit.ovirt.org/9783 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I3b8507f3c5f1e1d2712a37fba0162c9aaf56c3a3 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com