Permits a list of values for the "type=" tests attribute
The changes to the decorator simply call testtools.testcase.attr
multiple times in case type= is a list. Retains compatibility with
testr too.
Change-Id: I3d850b10f7cb8b7df69df3e583698c3d4f25bdbc
Implements: blueprint convert-attr-to-testtools
diff --git a/tempest/test.py b/tempest/test.py
index de255d5..9d6c2d3 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -37,13 +37,12 @@
"""
def decorator(f):
- testtool_attributes = ('smoke')
-
- if 'type' in kwargs and kwargs['type'] in testtool_attributes:
- return nose.plugins.attrib.attr(*args, **kwargs)(
- testtools.testcase.attr(kwargs['type'])(f))
- else:
- return nose.plugins.attrib.attr(*args, **kwargs)(f)
+ if 'type' in kwargs and isinstance(kwargs['type'], str):
+ f = testtools.testcase.attr(kwargs['type'])(f)
+ elif 'type' in kwargs and isinstance(kwargs['type'], list):
+ for attr in kwargs['type']:
+ f = testtools.testcase.attr(attr)(f)
+ return nose.plugins.attrib.attr(*args, **kwargs)(f)
return decorator