mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 00:49:33 +02:00
oeqa/core/decorator/data.py: Add skipIfNotFeature decorator
This adds a new decorator to check if image under tests has certain DISTRO_FEATURE or IMAGE_FEATURE. [YOCTO #10234] (From OE-Core rev: 8740803d0696a0e97b72210a56f4fbd3135826ed) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
9ee0816ca9
commit
bfe20fd23c
@@ -5,6 +5,16 @@ from oeqa.core.exception import OEQAMissingVariable
|
|||||||
|
|
||||||
from . import OETestDecorator, registerDecorator
|
from . import OETestDecorator, registerDecorator
|
||||||
|
|
||||||
|
def has_feature(td, feature):
|
||||||
|
"""
|
||||||
|
Checks for feature in DISTRO_FEATURES or IMAGE_FEATURES.
|
||||||
|
"""
|
||||||
|
|
||||||
|
if (feature in td.get('DISTRO_FEATURES', '') or
|
||||||
|
feature in td.get('IMAGE_FEATURES', '')):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
@registerDecorator
|
@registerDecorator
|
||||||
class skipIfDataVar(OETestDecorator):
|
class skipIfDataVar(OETestDecorator):
|
||||||
"""
|
"""
|
||||||
@@ -34,3 +44,21 @@ class OETestDataDepends(OETestDecorator):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
raise OEQAMissingVariable("Test case need %s variable but"\
|
raise OEQAMissingVariable("Test case need %s variable but"\
|
||||||
" isn't into td" % v)
|
" isn't into td" % v)
|
||||||
|
|
||||||
|
@registerDecorator
|
||||||
|
class skipIfNotFeature(OETestDecorator):
|
||||||
|
"""
|
||||||
|
Skip test based on DISTRO_FEATURES.
|
||||||
|
|
||||||
|
value must 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 in DISTRO_FEATURES '
|
||||||
|
'or IMAGE_FEATURES' % (self.value))
|
||||||
|
self.logger.debug(msg)
|
||||||
|
if not has_feature(self.case.td, self.value):
|
||||||
|
self.case.skipTest(self.msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user