diff options
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/utils/decorators.py | 40 |
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 @@ | |||
1 | from oeqa.oetest import * | ||
2 | |||
3 | class skipIfFailure(object): | ||
4 | |||
5 | def __init__(self,testcase): | ||
6 | self.testcase = testcase | ||
7 | |||
8 | def __call__(self,f): | ||
9 | def wrapped_f(*args): | ||
10 | if self.testcase in (oeRuntimeTest.testFailures or oeRuntimeTest.testErrors): | ||
11 | raise unittest.SkipTest("Testcase dependency not met: %s" % self.testcase) | ||
12 | f(*args) | ||
13 | wrapped_f.__name__ = f.__name__ | ||
14 | return wrapped_f | ||
15 | |||
16 | class skipIfSkipped(object): | ||
17 | |||
18 | def __init__(self,testcase): | ||
19 | self.testcase = testcase | ||
20 | |||
21 | def __call__(self,f): | ||
22 | def wrapped_f(*args): | ||
23 | if self.testcase in oeRuntimeTest.testSkipped: | ||
24 | raise unittest.SkipTest("Testcase dependency not met: %s" % self.testcase) | ||
25 | f(*args) | ||
26 | wrapped_f.__name__ = f.__name__ | ||
27 | return wrapped_f | ||
28 | |||
29 | class skipUnlessPassed(object): | ||
30 | |||
31 | def __init__(self,testcase): | ||
32 | self.testcase = testcase | ||
33 | |||
34 | def __call__(self,f): | ||
35 | def wrapped_f(*args): | ||
36 | if self.testcase in (oeRuntimeTest.testSkipped, oeRuntimeTest.testFailures, oeRuntimeTest.testErrors): | ||
37 | raise unittest.SkipTest("Testcase dependency not met: %s" % self.testcase) | ||
38 | f(*args) | ||
39 | wrapped_f.__name__ = f.__name__ | ||
40 | return wrapped_f | ||