summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/decorator/__init__.py
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2019-09-03 16:56:41 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-07 21:47:35 +0100
commitb8a4a4c2de68110d74607cb9807c9e741ca9441c (patch)
tree3651d11029d27d2a4c83de66be05f4ad213a2b69 /meta/lib/oeqa/core/decorator/__init__.py
parentb0831d43606415807af80e2aa1d0566d0b8c209c (diff)
downloadopenembedded-core-contrib-b8a4a4c2de68110d74607cb9807c9e741ca9441c.tar.gz
oeqa/core: Rework OETestTag and remove unused OETestFilter
Rework OETestTag so that it does not rely on the existing decorator code base and instead inserts the tags into an attribute on the decorated target (e.g. class/type or method). This allows the use of OETestTag on classes and method. In order to filter tagged tests rework the loaders filtering code, removing the generic-ness (with validation and attributes/etc.) and replace it with a "tags_filter" parameter which is a function that filters a test based on the tags it has. This allows the loader user to filter on tags in more specific ways (e.g. include all untagged tests and any tests tagged with foo). Plumb all this through the context code and testing code. Update the associated tests to pass correctly with the changes. Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/core/decorator/__init__.py')
-rw-r--r--meta/lib/oeqa/core/decorator/__init__.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/meta/lib/oeqa/core/decorator/__init__.py b/meta/lib/oeqa/core/decorator/__init__.py
index 923b218266..1a5ac40134 100644
--- a/meta/lib/oeqa/core/decorator/__init__.py
+++ b/meta/lib/oeqa/core/decorator/__init__.py
@@ -6,6 +6,7 @@
from functools import wraps
from abc import abstractmethod, ABCMeta
+from oeqa.core.utils.misc import strToList
decoratorClasses = set()
@@ -63,12 +64,15 @@ class OETestDiscover(OETestDecorator):
def discover(registry):
return registry['cases']
-class OETestFilter(OETestDecorator):
+def OETestTag(*tags):
+ expandedtags = []
+ for tag in tags:
+ expandedtags += strToList(tag)
+ def decorator(item):
+ if hasattr(item, "__oeqa_testtags"):
+ item.__oeqa_testtags += expandedtags
+ else:
+ item.__oeqa_testtags = expandedtags
+ return item
+ return decorator
- # OETestLoader call it while loading the tests
- # in loadTestsFromTestCase method, it needs to
- # return a bool, True if needs to be filtered.
- # This method must consume the filter used.
- @abstractmethod
- def filtrate(self, filters):
- return False