diff options
author | Radu Moisan <radu.moisan@intel.com> | 2013-06-28 11:28:57 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-07-09 10:48:59 +0100 |
commit | 79cb89648702aa80ec986e0026c62948de905b87 (patch) | |
tree | a858e5fb94af5c206e9c683663e3b5d8e29cb39e /meta | |
parent | ee7d64dfcc02ba8f568b17d181e0a58d3c810076 (diff) | |
download | openembedded-core-79cb89648702aa80ec986e0026c62948de905b87.tar.gz openembedded-core-79cb89648702aa80ec986e0026c62948de905b87.tar.bz2 openembedded-core-79cb89648702aa80ec986e0026c62948de905b87.zip |
lib/oeqa/utils/decorators.py: decorators for test methods
Some skip decorators meant only for test methods, providing
some kind of test methods dependency.
They are used together with a test method name not a condition.
These are complementary to python's unittest skip decorators.
Signed-off-by: Radu Moisan <radu.moisan@intel.com>
Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Diffstat (limited to 'meta')
-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 @@ +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 |