summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2016-11-09 11:24:57 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-23 12:05:18 +0000
commit4da4091cee20fd425addccd0d267a5b40f1ab8cd (patch)
tree68381dbde9c94d0ca1059547b0963920f9b102b7
parentb685a7c1a887c5eab7f3a232c91be564afb87ba9 (diff)
downloadpoky-4da4091cee20fd425addccd0d267a5b40f1ab8cd.tar.gz
oeqa/core/decorator: Add support for OETestDataDepends and skipIfDataVar
The OETestDataDepends decorator skips a test case if a variable isn't into test data (d). The skipIfDataVar decorator skips a test case if a variable has certain value. (From OE-Core rev: 7dc519d20e835ee7693c31903e164c4bc0e5e598) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/core/decorator/data.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/meta/lib/oeqa/core/decorator/data.py b/meta/lib/oeqa/core/decorator/data.py
new file mode 100644
index 0000000000..73cca88d7b
--- /dev/null
+++ b/meta/lib/oeqa/core/decorator/data.py
@@ -0,0 +1,36 @@
1# Copyright (C) 2016 Intel Corporation
2# Released under the MIT license (see COPYING.MIT)
3
4from oeqa.core.exception import OEQAMissingVariable
5
6from . import OETestDecorator, registerDecorator
7
8@registerDecorator
9class skipIfDataVar(OETestDecorator):
10 """
11 Skip test based on value of a data store's variable.
12
13 It will get the info of var from the data store and will
14 check it against value; if are equal it will skip the test
15 with msg as the reason.
16 """
17
18 attrs = ('var', 'value', 'msg')
19
20 def setUpDecorator(self):
21 msg = 'Checking if %r value is %r to skip test' % (self.var, self.value)
22 self.logger.debug(msg)
23 if self.case.td.get(self.var) == self.value:
24 self.case.skipTest(self.msg)
25
26@registerDecorator
27class OETestDataDepends(OETestDecorator):
28 attrs = ('td_depends',)
29
30 def setUpDecorator(self):
31 for v in self.td_depends:
32 try:
33 value = self.case.td[v]
34 except KeyError:
35 raise OEQAMissingVariable("Test case need %s variable but"\
36 " isn't into td" % v)