summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/decorator
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2016-12-12 10:12:15 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-23 12:05:20 +0000
commit41b0b31a84254d75b4cca8d5f61c680bda5dd926 (patch)
tree613215de6abab418bcb26a3a57599f5da395fa13 /meta/lib/oeqa/core/decorator
parentc35b42cdbbdc5d966fc9e4c0173273189f50c9c0 (diff)
downloadpoky-41b0b31a84254d75b4cca8d5f61c680bda5dd926.tar.gz
oeqa/core/decorator: Add skipIfNotDataVar and skipIfNotInDataVar
skipIfNotDataVar will skip a test if a variable doesn't have certain value. skipIfNotInDataVar will skip a test if a value is not in a certain variable. (From OE-Core rev: a81045f4e2b740173237f5ae4e80e2bc0b287faa) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/core/decorator')
-rw-r--r--meta/lib/oeqa/core/decorator/data.py36
1 files changed, 35 insertions, 1 deletions
diff --git a/meta/lib/oeqa/core/decorator/data.py b/meta/lib/oeqa/core/decorator/data.py
index fdeba9fe1d..ff7bdd98b7 100644
--- a/meta/lib/oeqa/core/decorator/data.py
+++ b/meta/lib/oeqa/core/decorator/data.py
@@ -28,12 +28,46 @@ class skipIfDataVar(OETestDecorator):
28 attrs = ('var', 'value', 'msg') 28 attrs = ('var', 'value', 'msg')
29 29
30 def setUpDecorator(self): 30 def setUpDecorator(self):
31 msg = 'Checking if %r value is %r to skip test' % (self.var, self.value) 31 msg = ('Checking if %r value is %r to skip test' %
32 (self.var, self.value))
32 self.logger.debug(msg) 33 self.logger.debug(msg)
33 if self.case.td.get(self.var) == self.value: 34 if self.case.td.get(self.var) == self.value:
34 self.case.skipTest(self.msg) 35 self.case.skipTest(self.msg)
35 36
36@registerDecorator 37@registerDecorator
38class skipIfNotDataVar(OETestDecorator):
39 """
40 Skip test based on value of a data store's variable.
41
42 It will get the info of var from the data store and will
43 check it against value; if are not equal it will skip the
44 test with msg as the reason.
45 """
46
47 attrs = ('var', 'value', 'msg')
48
49 def setUpDecorator(self):
50 msg = ('Checking if %r value is not %r to skip test' %
51 (self.var, self.value))
52 self.logger.debug(msg)
53 if not self.case.td.get(self.var) == self.value:
54 self.case.skipTest(self.msg)
55
56@registerDecorator
57class skipIfNotInDataVar(OETestDecorator):
58 """
59 Skip test if value is not in data store's variable.
60 """
61
62 attrs = ('var', 'value', 'msg')
63 def setUpDecorator(self):
64 msg = ('Checking if %r value is in %r to run '
65 'the test' % (self.var, self.value))
66 self.logger.debug(msg)
67 if not self.value in self.case.td.get(self.var):
68 self.case.skipTest(self.msg)
69
70@registerDecorator
37class OETestDataDepends(OETestDecorator): 71class OETestDataDepends(OETestDecorator):
38 attrs = ('td_depends',) 72 attrs = ('td_depends',)
39 73