Merge "Remove deprecated test.idempotent_id decorator"

This commit is contained in:
Zuul 2021-02-10 17:00:36 +00:00 committed by Gerrit Code Review
commit 4f9d125240
2 changed files with 0 additions and 48 deletions

View File

@ -38,12 +38,6 @@ LOG = logging.getLogger(__name__)
CONF = config.CONF
# TODO(oomichi): This test.idempotent_id should be removed after all projects
# switch to use decorators.idempotent_id.
idempotent_id = debtcollector.moves.moved_function(
decorators.idempotent_id, 'idempotent_id', __name__,
version='Mitaka', removal_version='?')
attr = debtcollector.moves.moved_function(
decorators.attr, 'attr', __name__,

View File

@ -19,7 +19,6 @@ import testtools
from tempest.common import utils
from tempest import config
from tempest import exceptions
from tempest.lib.common.utils import data_utils
from tempest import test
from tempest.tests import base
from tempest.tests import fake_config
@ -33,47 +32,6 @@ class BaseDecoratorsTest(base.TestCase):
fake_config.FakePrivate)
# NOTE: The test module is for tempest.test.idempotent_id.
# After all projects switch to use decorators.idempotent_id,
# we can remove tempest.test.idempotent_id as well as this
# test module
class TestIdempotentIdDecorator(BaseDecoratorsTest):
def _test_helper(self, _id, **decorator_args):
@test.idempotent_id(_id)
def foo():
"""Docstring"""
pass
return foo
def _test_helper_without_doc(self, _id, **decorator_args):
@test.idempotent_id(_id)
def foo():
pass
return foo
def test_positive(self):
_id = data_utils.rand_uuid()
foo = self._test_helper(_id)
self.assertIn('id-%s' % _id, getattr(foo, '__testtools_attrs'))
self.assertTrue(foo.__doc__.startswith('Test idempotent id: %s' % _id))
def test_positive_without_doc(self):
_id = data_utils.rand_uuid()
foo = self._test_helper_without_doc(_id)
self.assertTrue(foo.__doc__.startswith('Test idempotent id: %s' % _id))
def test_idempotent_id_not_str(self):
_id = 42
self.assertRaises(TypeError, self._test_helper, _id)
def test_idempotent_id_not_valid_uuid(self):
_id = '42'
self.assertRaises(ValueError, self._test_helper, _id)
class TestServicesDecorator(BaseDecoratorsTest):
def _test_services_helper(self, *decorator_args):
class TestFoo(test.BaseTestCase):