Matthew Treinish | 9e26ca8 | 2016-02-23 11:43:20 -0500 | [diff] [blame] | 1 | # 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 Treinish | 9e26ca8 | 2016-02-23 11:43:20 -0500 | [diff] [blame] | 15 | from oslo_log import log as logging |
| 16 | |
Jordan Pittier | 9e227c5 | 2016-02-09 14:35:18 +0100 | [diff] [blame] | 17 | from tempest.lib.common.utils import test_utils |
| 18 | |
Matthew Treinish | 9e26ca8 | 2016-02-23 11:43:20 -0500 | [diff] [blame] | 19 | LOG = logging.getLogger(__name__) |
| 20 | |
| 21 | |
| 22 | def 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 Pittier | 9e227c5 | 2016-02-09 14:35:18 +0100 | [diff] [blame] | 33 | def 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) |