summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/core/decorator/data.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/meta/lib/oeqa/core/decorator/data.py b/meta/lib/oeqa/core/decorator/data.py
index 73cca88d7b..fdeba9fe1d 100644
--- a/meta/lib/oeqa/core/decorator/data.py
+++ b/meta/lib/oeqa/core/decorator/data.py
@@ -5,6 +5,16 @@ from oeqa.core.exception import OEQAMissingVariable
5 5
6from . import OETestDecorator, registerDecorator 6from . import OETestDecorator, registerDecorator
7 7
8def has_feature(td, feature):
9 """
10 Checks for feature in DISTRO_FEATURES or IMAGE_FEATURES.
11 """
12
13 if (feature in td.get('DISTRO_FEATURES', '') or
14 feature in td.get('IMAGE_FEATURES', '')):
15 return True
16 return False
17
8@registerDecorator 18@registerDecorator
9class skipIfDataVar(OETestDecorator): 19class skipIfDataVar(OETestDecorator):
10 """ 20 """
@@ -34,3 +44,21 @@ class OETestDataDepends(OETestDecorator):
34 except KeyError: 44 except KeyError:
35 raise OEQAMissingVariable("Test case need %s variable but"\ 45 raise OEQAMissingVariable("Test case need %s variable but"\
36 " isn't into td" % v) 46 " isn't into td" % v)
47
48@registerDecorator
49class skipIfNotFeature(OETestDecorator):
50 """
51 Skip test based on DISTRO_FEATURES.
52
53 value must be in distro features or it will skip the test
54 with msg as the reason.
55 """
56
57 attrs = ('value', 'msg')
58
59 def setUpDecorator(self):
60 msg = ('Checking if %s is in DISTRO_FEATURES '
61 'or IMAGE_FEATURES' % (self.value))
62 self.logger.debug(msg)
63 if not has_feature(self.case.td, self.value):
64 self.case.skipTest(self.msg)