api-tests: Common way to define required extensions
As some tests require extensions to be enabled on the server, this patch
introduces a new class attribute to the API base class. If any extension
defined in test class is not enabled on the server, then all tests in
the test class will be skipped.
Change-Id: I0629153f973daeb3bef3a6968360cbc2d427f9ad
diff --git a/neutron/tests/tempest/api/test_timestamp.py b/neutron/tests/tempest/api/test_timestamp.py
index 8b57b2d..2406922 100644
--- a/neutron/tests/tempest/api/test_timestamp.py
+++ b/neutron/tests/tempest/api/test_timestamp.py
@@ -14,7 +14,6 @@
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
-from tempest import test
from neutron.tests.tempest.api import base
from neutron.tests.tempest.api import base_routers
@@ -26,6 +25,8 @@
class TestTimeStamp(base.BaseAdminNetworkTest):
+ required_extensions = ["standard-attr-timestamp"]
+
## attributes for subnetpool
min_prefixlen = '28'
max_prefixlen = '31'
@@ -35,11 +36,6 @@
larger_prefix = '10.11.0.0/16'
@classmethod
- @test.requires_ext(extension="standard-attr-timestamp", service="network")
- def skip_checks(cls):
- super(TestTimeStamp, cls).skip_checks()
-
- @classmethod
def resource_setup(cls):
super(TestTimeStamp, cls).resource_setup()
prefixes = ['10.11.12.0/24']
@@ -183,13 +179,8 @@
class TestTimeStampWithL3(base_routers.BaseRouterTest):
- @classmethod
- def skip_checks(cls):
- super(TestTimeStampWithL3, cls).skip_checks()
- if not test.is_extension_enabled('standard-attr-timestamp', 'network'):
- raise cls.skipException("standard-attr-timestamp extension not "
- "enabled")
+ required_extensions = ['standard-attr-timestamp']
@classmethod
def resource_setup(cls):
@@ -260,13 +251,8 @@
class TestTimeStampWithSecurityGroup(base_security_groups.BaseSecGroupTest):
- @classmethod
- def skip_checks(cls):
- super(TestTimeStampWithSecurityGroup, cls).skip_checks()
- if not test.is_extension_enabled('standard-attr-timestamp', 'network'):
- raise cls.skipException("standard-attr-timestamp extension not "
- "enabled")
+ required_extensions = ['standard-attr-timestamp']
@classmethod
def resource_setup(cls):