diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2017-06-08 11:32:05 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-12 15:04:09 +0100 |
commit | baac26f1b36e89e07637b738dd31ec7356f05a02 (patch) | |
tree | 4f46e51659badd144239d393955fe3b394cafdc1 /meta/lib/oeqa/core/loader.py | |
parent | 4d01610f36eaee8da3126bb5045856279371fd17 (diff) | |
download | openembedded-core-baac26f1b36e89e07637b738dd31ec7356f05a02.tar.gz openembedded-core-baac26f1b36e89e07637b738dd31ec7356f05a02.tar.bz2 openembedded-core-baac26f1b36e89e07637b738dd31ec7356f05a02.zip |
oeqa/core/loader: Allow unittest.TestCase's to be executed
Currently there was a restriction to only execute tests that's
inherits from OETestCase but in some circunstancies the features
from the OEQA framework isn't needed so we need to support
basic unittests.
[YOCTO #10828]
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/lib/oeqa/core/loader.py')
-rw-r--r-- | meta/lib/oeqa/core/loader.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/meta/lib/oeqa/core/loader.py b/meta/lib/oeqa/core/loader.py index 166fc35b4f..d110881698 100644 --- a/meta/lib/oeqa/core/loader.py +++ b/meta/lib/oeqa/core/loader.py @@ -185,7 +185,7 @@ class OETestLoader(unittest.TestLoader): return True # Decorator filters - if self.filters: + if self.filters and isinstance(case, OETestCase): filters = self.filters.copy() case_decorators = [cd for cd in case.decorators if cd.__class__ in self.used_filters] @@ -203,7 +203,8 @@ class OETestLoader(unittest.TestLoader): return False def _getTestCase(self, testCaseClass, tcName): - if not hasattr(testCaseClass, '__oeqa_loader'): + if not hasattr(testCaseClass, '__oeqa_loader') and \ + issubclass(testCaseClass, OETestCase): # In order to support data_vars validation # monkey patch the default setUp/tearDown{Class} to use # the ones provided by OETestCase @@ -230,7 +231,8 @@ class OETestLoader(unittest.TestLoader): setattr(testCaseClass, '__oeqa_loader', True) case = testCaseClass(tcName) - setattr(case, 'decorators', []) + if isinstance(case, OETestCase): + setattr(case, 'decorators', []) return case @@ -242,9 +244,9 @@ class OETestLoader(unittest.TestLoader): raise TypeError("Test cases should not be derived from TestSuite." \ " Maybe you meant to derive %s from TestCase?" \ % testCaseClass.__name__) - if not issubclass(testCaseClass, self.caseClass): + if not issubclass(testCaseClass, unittest.case.TestCase): raise TypeError("Test %s is not derived from %s" % \ - (testCaseClass.__name__, self.caseClass.__name__)) + (testCaseClass.__name__, unittest.case.TestCase.__name__)) testCaseNames = self.getTestCaseNames(testCaseClass) if not testCaseNames and hasattr(testCaseClass, 'runTest'): |