diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2017-07-26 10:04:09 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-30 08:45:11 +0100 |
commit | e50b415aaaa1581473f85f0a8afa278b5f95129b (patch) | |
tree | c435431882e48cbdde778a5a2abd7f458d6dac2a /meta/lib/oeqa/core/loader.py | |
parent | 07c5eb7f9232ecd4a094040cbe85af2727bd2bd5 (diff) | |
download | openembedded-core-e50b415aaaa1581473f85f0a8afa278b5f95129b.tar.gz openembedded-core-e50b415aaaa1581473f85f0a8afa278b5f95129b.tar.bz2 openembedded-core-e50b415aaaa1581473f85f0a8afa278b5f95129b.zip |
oeqa/{core,selftest}: Add support to validate if a specified test case isn't found
If some test module/case is specified to run and isn't found the OEQA
framework didn't notice it, so complete the implementation using
modules_required and validate for the test case prescense.
Raise an exception when the test module/case required isn't found.
[YOCTO #11645]
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/core/loader.py')
-rw-r--r-- | meta/lib/oeqa/core/loader.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/meta/lib/oeqa/core/loader.py b/meta/lib/oeqa/core/loader.py index e4c218b57f..332086a13d 100644 --- a/meta/lib/oeqa/core/loader.py +++ b/meta/lib/oeqa/core/loader.py @@ -9,6 +9,7 @@ import inspect from oeqa.core.utils.path import findFile from oeqa.core.utils.test import getSuiteModules, getCaseID +from oeqa.core.exception import OEQATestNotFound from oeqa.core.case import OETestCase from oeqa.core.decorator import decoratorClasses, OETestDecorator, \ OETestFilter, OETestDiscover @@ -277,6 +278,28 @@ class OETestLoader(unittest.TestLoader): return self.suiteClass(suite) + def _required_modules_validation(self): + """ + Search in Test context registry if a required + test is found, raise an exception when not found. + """ + + for module in self.modules_required: + found = False + + # The module name is splitted to only compare the + # first part of a test case id. + comp_len = len(module.split('.')) + for case in self.tc._registry['cases']: + case_comp = '.'.join(case.split('.')[0:comp_len]) + if module == case_comp: + found = True + break + + if not found: + raise OEQATestNotFound("Not found %s in loaded test cases" % \ + module) + def discover(self): big_suite = self.suiteClass() for path in self.module_paths: @@ -291,6 +314,9 @@ class OETestLoader(unittest.TestLoader): for clss in discover_classes: cases = clss.discover(self.tc._registry) + if self.modules_required: + self._required_modules_validation() + return self.suiteClass(cases) if cases else big_suite def _filterModule(self, module): |