Move InvalidServiceTag
We are going to make test.py stable for plugins, so it should only depend on tempest.lib and config. InvalidServiceTag is in the exceptions module. It cannot be moved in tempest.lib.exceptions since it has no meaning in there, so moving it to test.py directly. Change-Id: I969fb45a44ce08c176d64dfe1c58d75215eacdf5
This commit is contained in:
parent
b6532ddaad
commit
07acf26015
@ -17,10 +17,6 @@
|
||||
from tempest.lib import exceptions
|
||||
|
||||
|
||||
class InvalidServiceTag(exceptions.TempestException):
|
||||
message = "Invalid service tag"
|
||||
|
||||
|
||||
class BuildErrorException(exceptions.TempestException):
|
||||
message = "Server %(server_id)s failed to build and is in ERROR status"
|
||||
|
||||
|
@ -29,7 +29,6 @@ from tempest.common import credentials_factory as credentials
|
||||
from tempest.common import fixed_network
|
||||
import tempest.common.validation_resources as vresources
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.lib.common import cred_client
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
@ -55,6 +54,10 @@ attr = debtcollector.moves.moved_function(
|
||||
version='Pike', removal_version='?')
|
||||
|
||||
|
||||
class InvalidServiceTag(lib_exc.TempestException):
|
||||
message = "Invalid service tag"
|
||||
|
||||
|
||||
def get_service_list():
|
||||
service_list = {
|
||||
'compute': CONF.service_available.nova,
|
||||
@ -78,8 +81,7 @@ def services(*args):
|
||||
|
||||
for service in args:
|
||||
if service not in known_services:
|
||||
raise exceptions.InvalidServiceTag('%s is not a valid '
|
||||
'service' % service)
|
||||
raise InvalidServiceTag('%s is not a valid service' % service)
|
||||
decorators.attr(type=list(args))(f)
|
||||
|
||||
@functools.wraps(f)
|
||||
|
@ -17,7 +17,6 @@ from oslotest import mockpatch
|
||||
import testtools
|
||||
|
||||
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
|
||||
@ -91,7 +90,7 @@ class TestServicesDecorator(BaseDecoratorsTest):
|
||||
self._test_services_helper('compute', 'compute')
|
||||
|
||||
def test_services_decorator_with_invalid_service(self):
|
||||
self.assertRaises(exceptions.InvalidServiceTag,
|
||||
self.assertRaises(test.InvalidServiceTag,
|
||||
self._test_services_helper, 'compute',
|
||||
'bad_service')
|
||||
|
||||
@ -107,7 +106,7 @@ class TestServicesDecorator(BaseDecoratorsTest):
|
||||
for service in service_list:
|
||||
try:
|
||||
self._test_services_helper(service)
|
||||
except exceptions.InvalidServiceTag:
|
||||
except test.InvalidServiceTag:
|
||||
self.fail('%s is not listed in the valid service tag list'
|
||||
% service)
|
||||
except KeyError:
|
||||
|
Loading…
Reference in New Issue
Block a user