~ttx/nova/d4-merge

« back to all changes in this revision

Viewing changes to nova/tests/test_skip_examples.py

  • Committer: Thierry Carrez
  • Date: 2011-08-23 12:23:07 UTC
  • mfrom: (1130.75.258 nova)
  • Revision ID: thierry@openstack.org-20110823122307-f0vtuyg1ikc14n87
Merge diablo-4 development from trunk (rev1479)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
 
2
 
 
3
# Copyright 2010 United States Government as represented by the
 
4
# Administrator of the National Aeronautics and Space Administration.
 
5
# All Rights Reserved.
 
6
#
 
7
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
8
#    not use this file except in compliance with the License. You may obtain
 
9
#    a copy of the License at
 
10
#
 
11
#         http://www.apache.org/licenses/LICENSE-2.0
 
12
#
 
13
#    Unless required by applicable law or agreed to in writing, software
 
14
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
15
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
16
#    License for the specific language governing permissions and limitations
 
17
#    under the License.
 
18
 
 
19
from nova import test
 
20
 
 
21
 
 
22
class ExampleSkipTestCase(test.TestCase):
 
23
    test_counter = 0
 
24
 
 
25
    @test.skip_test("Example usage of @test.skip_test()")
 
26
    def test_skip_test_example(self):
 
27
        self.fail("skip_test failed to work properly.")
 
28
 
 
29
    @test.skip_if(True, "Example usage of @test.skip_if()")
 
30
    def test_skip_if_example(self):
 
31
        self.fail("skip_if failed to work properly.")
 
32
 
 
33
    @test.skip_unless(False, "Example usage of @test.skip_unless()")
 
34
    def test_skip_unless_example(self):
 
35
        self.fail("skip_unless failed to work properly.")
 
36
 
 
37
    @test.skip_if(False, "This test case should never be skipped.")
 
38
    def test_001_increase_test_counter(self):
 
39
        ExampleSkipTestCase.test_counter += 1
 
40
 
 
41
    @test.skip_unless(True, "This test case should never be skipped.")
 
42
    def test_002_increase_test_counter(self):
 
43
        ExampleSkipTestCase.test_counter += 1
 
44
 
 
45
    def test_003_verify_test_counter(self):
 
46
        self.assertEquals(ExampleSkipTestCase.test_counter, 2,
 
47
                          "Tests were not skipped appropriately")