GitHub user gauravaradhye opened a pull request:
https://github.com/apache/cloudstack/pull/190
CLOUDSTACK-8394: Use custom decorator to skip test case
When the tests are skipped through setUpClass, the statement "raise
unittest.SkipTest()" is used. This is seen as exception in the logs. To avoid
this, alternatively we can set class level variable in setUpClass and read this
variable value in a custom decorator. Decorator will skip or run test cases
accordingly.
This patch demonstrates that, when test is run on a hypervisor on which the
feature is not supported, we set "hypervisorNotSupported" variable to True and
pass this variable as argument to the decorator.
Decorator gets the value of this attribute, examines it, if it's true,
skips the test case, or else runs the test case as it is.
Also the expensive steps in setUpClass are run only if hypervisor is
supported.
Miscellaneous changes:
1. Fix import *
2. Remove unused variables
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/gauravaradhye/cloudstack 8394
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cloudstack/pull/190.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #190
----
commit a0451060dd404eede895c847361b956b480c4010
Author: Gaurav Aradhye <[email protected]>
Date: 2015-04-24T08:45:37Z
CLOUDSTACK-8394: Use custom decorator to skip test case
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---