mirror of
git://git.yoctoproject.org/poky
synced 2026-08-08 00:01:32 +00:00
Add oeTest superclass, make oeRuntimeTest inherit that and make the necesarry adjustments. Tests in lib/oeqa/runtime don't change, they still inherit oeRuntimeTest. We should do this because oetest.py in the future can be a base module for more stuff than oeRuntimeTest. (From OE-Core rev: cd4ed41a070bd52c446ac3df8337f17ab9421145) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
# Copyright (C) 2013 Intel Corporation
|
|
#
|
|
# Released under the MIT license (see COPYING.MIT)
|
|
|
|
# Some custom decorators that can be used by unittests
|
|
# Most useful is skipUnlessPassed which can be used for
|
|
# creating dependecies between two test methods.
|
|
|
|
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 (oeTest.testFailures or oeTest.testErrors):
|
|
raise unittest.SkipTest("Testcase dependency not met: %s" % self.testcase)
|
|
return 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 oeTest.testSkipped:
|
|
raise unittest.SkipTest("Testcase dependency not met: %s" % self.testcase)
|
|
return 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 oeTest.testSkipped or \
|
|
self.testcase in oeTest.testFailures or \
|
|
self.testcase in oeTest.testErrors:
|
|
raise unittest.SkipTest("Testcase dependency not met: %s" % self.testcase)
|
|
return f(*args)
|
|
wrapped_f.__name__ = f.__name__
|
|
return wrapped_f
|