[OE-core] [PATCH 07/32] oeqa/core/decorator: Add support for OETestDataDepends and skipIfDataVar
Aníbal Limón
anibal.limon at linux.intel.com
Tue Dec 6 21:43:52 UTC 2016
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.
Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
Signed-off-by: Mariano Lopez <mariano.lopez at linux.intel.com>
---
meta/lib/oeqa/core/decorator/data.py | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100644 meta/lib/oeqa/core/decorator/data.py
diff --git a/meta/lib/oeqa/core/decorator/data.py b/meta/lib/oeqa/core/decorator/data.py
new file mode 100644
index 0000000..51ef6fe
--- /dev/null
+++ b/meta/lib/oeqa/core/decorator/data.py
@@ -0,0 +1,36 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+from oeqa.core.exception import OEQAMissingVariable
+
+from . import OETestDecorator, registerDecorator
+
+ at registerDecorator
+class skipIfDataVar(OETestDecorator):
+ """
+ Skip test based on value of a data store's variable.
+
+ It will get the info of var from the data store and will
+ check it against value; if are equal it will skip the test
+ with msg as the reason.
+ """
+
+ attrs = ('var', 'value', 'msg')
+
+ def setUpDecorator(self):
+ msg = 'Checking if %r value is %r to skip test' % (self.var, self.value)
+ self.logger.debug(msg)
+ if self.case.tc.d.get(self.var) == self.value:
+ self.case.skipTest(self.msg)
+
+ at registerDecorator
+class OETestDataDepends(OETestDecorator):
+ attrs = ('data_depends',)
+
+ def setUpDecorator(self):
+ for v in self.data_depends:
+ try:
+ value = self.case.d[v]
+ except KeyError:
+ raise OEQAMissingVariable("Test case need %s variable but"\
+ " isn't into d" % v)
--
2.1.4
More information about the Openembedded-core
mailing list