summaryrefslogtreecommitdiff
path: root/meta/lib/oeqa/utils
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/utils')
-rw-r--r--meta/lib/oeqa/utils/decorators.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/meta/lib/oeqa/utils/decorators.py b/meta/lib/oeqa/utils/decorators.py
new file mode 100644
index 0000000000..21e6b22cb9
--- /dev/null
+++ b/meta/lib/oeqa/utils/decorators.py
@@ -0,0 +1,40 @@
+from oeqa.oetest import *
+
+class skipIfFailure(object):
+
+ def __init__(self,testcase):
+ self.testcase = testcase
+
+ def __call__(self,f):
+ def wrapped_f(*args):
+ if self.testcase in (oeRuntimeTest.testFailures or oeRuntimeTest.testErrors):
+ raise unittest.SkipTest("Testcase dependency not met: %s" % self.testcase)
+ f(*args)
+ wrapped_f.__name__ = f.__name__
+ return wrapped_f
+
+class skipIfSkipped(object):
+
+ def __init__(self,testcase):
+ self.testcase = testcase
+
+ def __call__(self,f):
+ def wrapped_f(*args):
+ if self.testcase in oeRuntimeTest.testSkipped:
+ raise unittest.SkipTest("Testcase dependency not met: %s" % self.testcase)
+ f(*args)
+ wrapped_f.__name__ = f.__name__
+ return wrapped_f
+
+class skipUnlessPassed(object):
+
+ def __init__(self,testcase):
+ self.testcase = testcase
+
+ def __call__(self,f):
+ def wrapped_f(*args):
+ if self.testcase in (oeRuntimeTest.testSkipped, oeRuntimeTest.testFailures, oeRuntimeTest.testErrors):
+ raise unittest.SkipTest("Testcase dependency not met: %s" % self.testcase)
+ f(*args)
+ wrapped_f.__name__ = f.__name__
+ return wrapped_f