summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/decorator/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/core/decorator/__init__.py')
-rw-r--r--meta/lib/oeqa/core/decorator/__init__.py33
1 files changed, 18 insertions, 15 deletions
diff --git a/meta/lib/oeqa/core/decorator/__init__.py b/meta/lib/oeqa/core/decorator/__init__.py
index 855b6b9d28..93efd30e1d 100644
--- a/meta/lib/oeqa/core/decorator/__init__.py
+++ b/meta/lib/oeqa/core/decorator/__init__.py
@@ -1,16 +1,19 @@
+#
# Copyright (C) 2016 Intel Corporation
-# Released under the MIT license (see COPYING.MIT)
+#
+# SPDX-License-Identifier: MIT
+#
from functools import wraps
-from abc import abstractmethod
+from abc import ABCMeta
decoratorClasses = set()
-def registerDecorator(obj):
- decoratorClasses.add(obj)
- return obj
+def registerDecorator(cls):
+ decoratorClasses.add(cls)
+ return cls
-class OETestDecorator(object):
+class OETestDecorator(object, metaclass=ABCMeta):
case = None # Reference of OETestCase decorated
attrs = None # Attributes to be loaded by decorator implementation
@@ -60,12 +63,12 @@ class OETestDiscover(OETestDecorator):
def discover(registry):
return registry['cases']
-class OETestFilter(OETestDecorator):
-
- # 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
+def OETestTag(*tags):
+ def decorator(item):
+ if hasattr(item, "__oeqa_testtags"):
+ # do not append, create a new list (to handle classes with inheritance)
+ item.__oeqa_testtags = list(item.__oeqa_testtags) + list(tags)
+ else:
+ item.__oeqa_testtags = tags
+ return item
+ return decorator