From ff2218f7cc3992725dd35499c14ec3396120dcc5 Mon Sep 17 00:00:00 2001 From: André Draszik Date: Wed, 16 Oct 2019 10:18:23 +0100 Subject: oeqa/core/decorator: add skipIfFeature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit skipIfFeature will skip a test if a given DIST_FEATURE or IMAGE_FEATURE is enabled. Signed-off-by: André Draszik Signed-off-by: Richard Purdie --- meta/lib/oeqa/core/decorator/data.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'meta/lib') diff --git a/meta/lib/oeqa/core/decorator/data.py b/meta/lib/oeqa/core/decorator/data.py index babc9789d6..12d462f202 100644 --- a/meta/lib/oeqa/core/decorator/data.py +++ b/meta/lib/oeqa/core/decorator/data.py @@ -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) -- cgit 1.2.3-korg