blob: f13b4c8821447803066eb8a71562dc48c5bc1b30 [file] [log] [blame]
Matthew Treinish9e26ca82016-02-23 11:43:20 -05001# Copyright 2012 OpenStack Foundation
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.
Matthew Treinish9e26ca82016-02-23 11:43:20 -050015from oslo_log import log as logging
16
Jordan Pittier9e227c52016-02-09 14:35:18 +010017from tempest.lib.common.utils import test_utils
18
Matthew Treinish9e26ca82016-02-23 11:43:20 -050019LOG = logging.getLogger(__name__)
20
21
22def singleton(cls):
23 """Simple wrapper for classes that should only have a single instance."""
24 instances = {}
25
26 def getinstance():
27 if cls not in instances:
28 instances[cls] = cls()
29 return instances[cls]
30 return getinstance
31
32
Jordan Pittier9e227c52016-02-09 14:35:18 +010033def find_test_caller(*args, **kwargs):
34 LOG.warning("tempest.lib.common.utils.misc.find_test_caller is deprecated "
35 "in favor of tempest.lib.common.utils.test_utils."
36 "find_test_caller")
37 test_utils.find_test_caller(*args, **kwargs)