diff options
| author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2016-12-02 16:05:44 -0600 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-23 12:05:20 +0000 |
| commit | bfe20fd23cb1efec9289ba5a2486234e6c8a0549 (patch) | |
| tree | 7b828ead90537be35eafb55dba344a836b03f882 /meta | |
| parent | 9ee0816ca9f71b503fcaa0046e2fec14ba2db4e6 (diff) | |
| download | poky-bfe20fd23cb1efec9289ba5a2486234e6c8a0549.tar.gz | |
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>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/lib/oeqa/core/decorator/data.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/meta/lib/oeqa/core/decorator/data.py b/meta/lib/oeqa/core/decorator/data.py index 73cca88d7b..fdeba9fe1d 100644 --- a/meta/lib/oeqa/core/decorator/data.py +++ b/meta/lib/oeqa/core/decorator/data.py | |||
| @@ -5,6 +5,16 @@ from oeqa.core.exception import OEQAMissingVariable | |||
| 5 | 5 | ||
| 6 | from . import OETestDecorator, registerDecorator | 6 | from . import OETestDecorator, registerDecorator |
| 7 | 7 | ||
| 8 | def has_feature(td, feature): | ||
| 9 | """ | ||
| 10 | Checks for feature in DISTRO_FEATURES or IMAGE_FEATURES. | ||
| 11 | """ | ||
| 12 | |||
| 13 | if (feature in td.get('DISTRO_FEATURES', '') or | ||
| 14 | feature in td.get('IMAGE_FEATURES', '')): | ||
| 15 | return True | ||
| 16 | return False | ||
| 17 | |||
| 8 | @registerDecorator | 18 | @registerDecorator |
| 9 | class skipIfDataVar(OETestDecorator): | 19 | class skipIfDataVar(OETestDecorator): |
| 10 | """ | 20 | """ |
| @@ -34,3 +44,21 @@ class OETestDataDepends(OETestDecorator): | |||
| 34 | except KeyError: | 44 | except KeyError: |
| 35 | raise OEQAMissingVariable("Test case need %s variable but"\ | 45 | raise OEQAMissingVariable("Test case need %s variable but"\ |
| 36 | " isn't into td" % v) | 46 | " isn't into td" % v) |
| 47 | |||
| 48 | @registerDecorator | ||
| 49 | class skipIfNotFeature(OETestDecorator): | ||
| 50 | """ | ||
| 51 | Skip test based on DISTRO_FEATURES. | ||
| 52 | |||
| 53 | value must be in distro features or it will skip the test | ||
| 54 | with msg as the reason. | ||
| 55 | """ | ||
| 56 | |||
| 57 | attrs = ('value', 'msg') | ||
| 58 | |||
| 59 | def setUpDecorator(self): | ||
| 60 | msg = ('Checking if %s is in DISTRO_FEATURES ' | ||
| 61 | 'or IMAGE_FEATURES' % (self.value)) | ||
| 62 | self.logger.debug(msg) | ||
| 63 | if not has_feature(self.case.td, self.value): | ||
| 64 | self.case.skipTest(self.msg) | ||
