<div dir="ltr"><br><div class="gmail_extra">In Keystone, we've got some tests that "raise self.skipTest('...')"
 in the test class setUp() method (not setUpClass). My testing shows 
that if there's several tests in the class then it shows all of those 
tests as skipped (not just 1 skip). Does this do what you want?<br><br><div>Here's an example: <br><a href="http://git.openstack.org/cgit/openstack/keystone/tree/keystone/tests/test_ipv6.py?id=73dbc00e6ac049f19d0069ecb07ca8ed75627dd5#n30">http://git.openstack.org/cgit/openstack/keystone/tree/keystone/tests/test_ipv6.py?id=73dbc00e6ac049f19d0069ecb07ca8ed75627dd5#n30</a><br>
</div><div><br><a href="http://git.openstack.org/cgit/openstack/keystone/tree/keystone/tests/core.py?id=73dbc00e6ac049f19d0069ecb07ca8ed75627dd5#n500">http://git.openstack.org/cgit/openstack/keystone/tree/keystone/tests/core.py?id=73dbc00e6ac049f19d0069ecb07ca8ed75627dd5#n500</a><br>
<br></div> - Brant<br><br><div class="gmail_quote">On Wed, Dec 4, 2013 at 5:46 AM, Daisuke Morita <span dir="ltr"><<a href="mailto:morita.daisuke@lab.ntt.co.jp" target="_blank">morita.daisuke@lab.ntt.co.jp</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi, everyone.<br>
<br>
Which do you think is the best way of coding test skipping, "writing<br>
cls.skipException statement in setUpClass method" or "skipIf annotation<br>
for each test method" ?<br>
<br>
This question comes to me in reviewing<br>
<a href="https://review.openstack.org/#/c/59759/" target="_blank">https://review.openstack.org/#/c/59759/</a> . I think that work itself is<br>
great and I hope this patch is merged to Tempest. I just want to focus<br>
on coding styles and explicitness of test outputs.<br>
<br>
If skipIf annotation is used, test output of Swift is as follows.<br>
<br>
---<br>
tempest.api.object_storage.test_account_quotas.AccountQuotasTest<br>
    test_admin_modify_quota[gate,smoke]<br>
SKIP  1.15<br>
    test_upload_large_object[gate,negative,smoke]<br>
SKIP  0.03<br>
    test_upload_valid_object[gate,smoke]<br>
SKIP  0.03<br>
    test_user_modify_quota[gate,negative,smoke]<br>
SKIP  0.03<br>
tempest.api.object_storage.test_account_services.AccountTest<br>
    test_create_and_delete_account_metadata[gate,smoke]               OK<br>
 0.32<br>
    test_list_account_metadata[gate,smoke]                            OK<br>
 0.02<br>
    test_list_containers[gate,smoke]                                  OK<br>
 0.02<br>
<br>
...(SKIP)...<br>
<br>
Ran 54 tests in 85.977s<br>
<br>
OK<br>
---<br>
<br>
<br>
On the other hand, if cls.skipException is used, an output is changed as<br>
follows.<br>
<br>
---<br>
setUpClass (tempest.api.object_storage.test_account_quotas<br>
    AccountQuotasTest)<br>
SKIP  0.00<br>
tempest.api.object_storage.test_account_services.AccountTest<br>
    test_create_and_delete_account_metadata[gate,smoke]               OK<br>
 0.48<br>
    test_list_account_metadata[gate,smoke]                            OK<br>
 0.02<br>
    test_list_containers[gate,smoke]                                  OK<br>
 0.02<br>
<br>
...(SKIP)...<br>
<br>
Ran 49 tests in 81.475s<br>
<br>
OK<br>
---<br>
<br>
<br>
I believe the output of the code using skipIf annotation is better.<br>
Since the coverage of tests is displayed more definitely, it is easier<br>
to find out what tests are really skipped.<br>
<br>
I scanned the whole code of Tempest. The count of cls.skipException<br>
statements is 63, and the count of skipIf annotations is 24. Replacing<br>
them is not trivial task, but I think the most impportant for testing is<br>
to output consistent and accurate log.<br>
<br>
<br>
Am I missing something? Or, this kind of discussion has been done<br>
already in the past? If so, could you let me know?<br>
<br>
<br>
Best Regards,<br>
<span class=""><font color="#888888"><br>
--<br>
Daisuke Morita <<a href="mailto:morita.daisuke@lab.ntt.co.jp">morita.daisuke@lab.ntt.co.jp</a>><br>
NTT Software Innovation Center, NTT Corporation<br>
<br>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</font></span></blockquote></div><br></div></div>