blob: 2c16e1cdecd17dade252b9b59045aec8e6bdf5af [file] [log] [blame]
Matthew Treinish9e26ca82016-02-23 11:43:20 -05001# Copyright 2014 Mirantis Inc.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16import testtools
17
18from tempest.lib import base
19from tempest.lib import exceptions
20
21
22class TestAttr(base.BaseTestCase):
23
24 def test_has_no_attrs(self):
25 self.assertEqual(
26 'tempest.tests.lib.test_base.TestAttr.test_has_no_attrs',
27 self.id()
28 )
29
30 @testtools.testcase.attr('foo')
31 def test_has_one_attr(self):
32 self.assertEqual(
33 'tempest.tests.lib.test_base.TestAttr.test_has_one_attr[foo]',
34 self.id()
35 )
36
37 @testtools.testcase.attr('foo')
38 @testtools.testcase.attr('bar')
39 def test_has_two_attrs(self):
40 self.assertEqual(
41 'tempest.tests.lib.test_base.TestAttr.test_has_two_attrs[bar,foo]',
42 self.id(),
43 )
44
45
46class TestSetUpClass(base.BaseTestCase):
47
48 @classmethod
49 def setUpClass(cls): # noqa
50 """Simulate absence of super() call."""
Ghanshyam Manne64c78d2019-10-10 22:26:43 +000051 cls.orig_skip_exception = cls.skipException
Matthew Treinish9e26ca82016-02-23 11:43:20 -050052
53 def setUp(self):
54 try:
55 # We expect here RuntimeError exception because 'setUpClass'
56 # has not called 'super'.
57 super(TestSetUpClass, self).setUp()
58 except RuntimeError:
59 pass
60 else:
61 raise exceptions.TempestException(
62 "If you see this, then expected exception was not raised.")
63
64 def test_setup_class_raises_runtime_error(self):
65 """No-op test just to call setUp."""