[
https://issues.apache.org/jira/browse/CLOUDSTACK-8394?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14510668#comment-14510668
]
ASF GitHub Bot commented on CLOUDSTACK-8394:
--------------------------------------------
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
----
> Use decorators to skip test case depending on class variables set in
> setUpClass
> -------------------------------------------------------------------------------
>
> Key: CLOUDSTACK-8394
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8394
> Project: CloudStack
> Issue Type: Test
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Components: Automation
> Affects Versions: Future
> Reporter: Gaurav Aradhye
> Assignee: Gaurav Aradhye
> Labels: automation
> Fix For: Future
>
>
> 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 message was sent by Atlassian JIRA
(v6.3.4#6332)