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
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index f48d7ac..a437761 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -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"
diff --git a/tempest/test.py b/tempest/test.py
index 10cc1cf..2ebdc60 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -29,7 +29,6 @@
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 @@
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 @@
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)
diff --git a/tempest/tests/test_decorators.py b/tempest/tests/test_decorators.py
index 149a54c..8b6472b 100644
--- a/tempest/tests/test_decorators.py
+++ b/tempest/tests/test_decorators.py
@@ -17,7 +17,6 @@
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 @@
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 @@
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: