oeqa/core/decorator: add skipIfFeature

skipIfFeature will skip a test if a given DIST_FEATURE
or IMAGE_FEATURE is enabled.

(From OE-Core rev: ff2218f7cc3992725dd35499c14ec3396120dcc5)

Signed-off-by: André Draszik <git@andred.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
André Draszik
2019-10-16 10:18:23 +01:00
committed by Richard Purdie
parent 077c3bbf2f
commit 34cce61ece

View File

@@ -113,3 +113,21 @@ class skipIfNotFeature(OETestDecorator):
self.logger.debug(msg)
if not has_feature(self.case.td, self.value):
self.case.skipTest(self.msg)
@registerDecorator
class skipIfFeature(OETestDecorator):
"""
Skip test based on DISTRO_FEATURES.
value must not be in distro features or it will skip the test
with msg as the reason.
"""
attrs = ('value', 'msg')
def setUpDecorator(self):
msg = ('Checking if %s is not in DISTRO_FEATURES '
'or IMAGE_FEATURES' % (self.value))
self.logger.debug(msg)
if has_feature(self.case.td, self.value):
self.case.skipTest(self.msg)